function CopyBlock(from_name, to_name) { from_block = document.getElementById(from_name); to_block = document.getElementById(to_name); if (from_block && to_block) to_block.innerHTML = from_block.innerHTML; } function MoveBlock(from_name, to_name) { from_block = document.getElementById(from_name); to_block = document.getElementById(to_name); if (from_block && to_block) { to_block.innerHTML = from_block.innerHTML; from_block.innerHTML = ""; } } function OpenBuyMode() { var cmp_form = document.getElementById('buy_form'); if (cmp_form) { cmp_form.submit(); return false; } return true; } function OpenCompareMode() { var cmp_form = document.getElementById('compare_form'); if (cmp_form) { cmp_form.submit(); return false; } return true; } function SelectColor(div_id) { $(document).ready(function(){ $('#'+div_id).ColorPicker({ color: document.getElementById(div_id+'_value').value, onChange: function (hsb, hex, rgb) { $('#'+div_id+' div').css('backgroundColor', '#' + hex); document.getElementById(div_id+'_value').value = '#' + hex;} }); }); } function open_parent(addr) { window.opener.location.href = addr; window.close(); } function GetAbsolutePos(obj) { var x = 0; var y = 0; var p = obj; while (p) { x += p.offsetLeft; y += p.offsetTop; p = p.offsetParent; } return {"x":x,"y":y}; } var mouseX; var mouseY; var menu = null; menu_button = null; /* direction: 1-left, 2-right, 3-down, 4-up */ function ShowMenu(blockName, btn, direction) { if (menu) { menu.style.display = 'none'; menu = null; menu_button = null; } var block = document.getElementById(blockName); if (block && btn) { var p = GetAbsolutePos(btn); block.style.display = ''; if (direction == 1) { block.style.left = p.x - btn.offsetWidth; block.style.top = p.y; } if (direction == 2) { block.style.left = p.x + btn.offsetWidth; block.style.top = p.y; } if (direction == 3) { block.style.left = p.x; block.style.top = p.y + btn.offsetHeight; } if (direction == 4) { block.style.left = p.x; block.style.top = p.y - btn.offsetHeight; } menu = block; menu_button = btn; } } function CheckMenu() { if (!menu) return; var p = GetAbsolutePos(menu); var d = 50; if ((mouseX < p.x - d) || (mouseX > p.x + menu.offsetWidth + d) || (mouseY < p.y - d) || (mouseY > p.y + menu.offsetHeight + d)) { var p = GetAbsolutePos(menu_button); if ((mouseX < p.x - d) || (mouseX > p.x + menu.offsetWidth + d) || (mouseY < p.y - d) || (mouseY > p.y + menu.offsetHeight + d)) { menu.style.display = 'none'; menu = null; } } } function selectSearchWhat(search_form_name, search_what) { var search_form; for(var i=-5; i<10; i++) { if (i == search_what) ShowBlock(search_form_name+"search_form_"+i); else HideBlock(search_form_name+"search_form_"+i); } var qq = document.getElementById(search_form_name+"search_what_"+search_what); if (qq) { for (i = 0; i 1) this.disabled = false; else this.disabled = true; comboOrderConditionChange(this); }); for(var i = 0; i < combo.options.length; i++) { var v = combo.options[i].value; var nv = -combo.options[i].value; if (v) if (combo.selectedIndex == i) { $("tr[rel^='transpay_"+v+"x']").css("display", ""); $("tr[rel^='transpay_"+nv+"x']").css("display", "none"); } else { $("tr[rel^='transpay_"+v+"x']").css("display", "none"); $("tr[rel^='transpay_"+nv+"x']").css("display", ""); } } } function searchReset(search_form_name, product_type) { var search_param; search_param = document.getElementById(search_form_name+"search_category_"+product_type); if (search_param != null) { search_param.value = ""; } search_param = document.getElementById(search_form_name+"search_text_"+product_type); if (search_param != null) { search_param.value = ""; } search_param = document.getElementById(search_form_name+"search_stock_"+product_type); if (search_param != null) { search_param.checked = ""; } search_param = document.getElementById(search_form_name+"search_min_price_"+product_type); if (search_param != null) { search_param.value = ""; } search_param = document.getElementById(search_form_name+"search_max_price_"+product_type); if (search_param != null) { search_param.value = ""; } for(var i=0; i<50; i++) { search_param = document.getElementById(search_form_name+"search_param_"+product_type+"_var0_"+i+"_1"); if (search_param != null) { search_param.value = ""; } search_param = document.getElementById(search_form_name+"search_param_"+product_type+"_var0_"+i+"_2"); if (search_param != null) { search_param.value = ""; } search_param = document.getElementById(search_form_name+"search_param_"+product_type+"_var1_"+i+"_1"); if (search_param != null) { search_param.value = ""; } search_param = document.getElementById(search_form_name+"search_param_"+product_type+"_var1_"+i+"_2"); if (search_param != null) { search_param.value = ""; } } } var PreloadedImages = new Array(); function PreloadImages() { for(i=0; iСТОП'; } player.innerHTML = ''; } else { if (status) { status.innerHTML = default_name; } player.innerHTML = ' '; } } function dynamicSelect(id1, id2) { if (document.getElementById && document.getElementsByTagName) { var sel1 = document.getElementById(id1); var sel2 = document.getElementById(id2); var clone = sel2.cloneNode(true); var clonedOptions = clone.getElementsByTagName("option"); refreshDynamicSelectOptions(sel1, sel2, clonedOptions); sel1.onchange = function() { refreshDynamicSelectOptions(sel1, sel2, clonedOptions); } } } function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) { while (sel2.options.length) { sel2.remove(0); } var pattern1 = /( |^)(select)( |$)/; var pattern2 = new RegExp("( |^)(" + sel1.options[sel1.selectedIndex].value + ")( |$)"); for (var i = 0; i < clonedOptions.length; i++) { if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match(pattern2)) { sel2.appendChild(clonedOptions[i].cloneNode(true)); } } } function ShowIfChecked(cb, what) { qq = document.getElementById(what); if (cb.checked) { qq.style.opacity = '1'; qq.style.filter = 'alpha(opacity: 100)'; } else { qq.style.opacity = '0.3'; qq.style.filter = 'alpha(opacity: 30)'; } } function setOpacity(element, opacity) { var e = document.getElementById(element); if (e) { if (opacity <= 0) { e.style.display = 'none'; } else { e.style.opacity = opacity/100; e.style.filter = 'alpha(opacity: '+opacity+')'; e.style.display = ''; } } } function photo_change(input_name, info_name, cb_name) { var fileInput = document.getElementById(input_name); var info = document.getElementById(info_name); var cb = document.getElementById(cb_name); var i = fileInput.value.lastIndexOf('\\'); if (i < 0) { i = fileInput.value.lastIndexOf('/'); } var n; if (i >= 0) { n = fileInput.value.substring(i+1); } else { n = fileInput.value; } info.innerHTML = 'Выбран файл
'+n+''; cb.checked = true; cb.onchange(); } function showTime() { var block = document.getElementById("time"); vr=new Date(); block.innerText=vr.getHours()+":"+vr.getMinutes()+":"+vr.getSeconds(); setTimeout("showTime()",1000) } function HideBlock(blockName) { var block = document.getElementById(blockName); if (block) { block.style.display = 'none'; } } function ShowBlock(blockName) { var block = document.getElementById(blockName); if (block) { block.style.display = ''; } } function ShowBlocks(propName, propValue) { $("["+propName+"^='"+propValue+"']").css("display", ""); } function HideBlocks(propName, propValue) { $("["+propName+"^='"+propValue+"']").css("display", "none"); } function ShowHideBlock(blockName, plus, selectName) { var block = document.getElementById(blockName); if (block.style.display == 'none') { block.style.display = ''; if (plus) { block = document.getElementById(blockName+"_expand"); if (block) { block.innerHTML = "-"; } } if (selectName != "") { block = document.getElementById(selectName); if (block) { block.focus(); block.select(); } } } else { block.style.display = 'none'; if (plus) { block = document.getElementById(blockName+"_expand"); if (block) { block.innerHTML = "+"; } } } } function ShowHideBlock3(blockName, plus, selectName) { var block = document.getElementById(blockName); if (block.style.display == 'none') { block.style.display = ''; if (plus) { block = document.getElementById(blockName+"_expand1"); if (block) { block.style.display = ''; } block = document.getElementById(blockName+"_expand2"); if (block) { block.style.display = 'none'; } } if (selectName != "") { block = document.getElementById(selectName); if (block) { block.focus(); block.select(); } } } else { block.style.display = 'none'; if (plus) { block = document.getElementById(blockName+"_expand1"); if (block) { block.style.display = 'none'; } block = document.getElementById(blockName+"_expand2"); if (block) { block.style.display = ''; } } } } var traversal = typeof document .createElement('div') .childElementCount != 'undefined'; var next = traversal ? function(node) { return node.nextElementSibling; } : function(node) { while(node = node.nextSibling) if(node.nodeType == 1) break; return node; }; var previous = traversal ? function(node) { return node.previousElementSibling; } : function(node) { while(node = node.previousSibling) if(node.nodeType == 1) break; return node; }; function ShowHideBlock2(blockName) { var new_vis; var block = document.getElementById(blockName+"_expand"); if (block) { if (block.innerHTML == "+") { block.innerHTML = "-"; new_vis = ""; } else { block.innerHTML = "+"; new_vis = "none"; } } var block = document.getElementById(blockName); var level = block.getAttribute("level"); if (new_vis == "") { do { block = next(block); if (block.getAttribute("level")-1 == level) { block.style.display = new_vis; } } while (block.getAttribute("level") != level); } else { do { block = next(block); if (block.getAttribute("level") != level) { block.style.display = new_vis; var plus = document.getElementById(block.getAttribute("id")+"_expand"); if (plus) { plus.innerHTML = "+"; } } } while (block.getAttribute("level") != level); } } var price = Array(); var old_price = Array(); var stock = Array(); var link = Array(); var child_values = Array(); var compare = Array(); var compare2 = Array(); function SetValue(name, value, def) { if (value == undefined) { value = def; } x = document.getElementById(name); if (x) x.innerHTML = value; } function UpdatePrice(productID) { var x; var values = ''; x = document.getElementById('sel_'+productID); SetValue('stock_'+productID, stock[productID+'_'+x.value], ''); SetValue('price_'+productID, price[productID+'_'+x.value], '0'); SetValue('old_price_'+productID, old_price[productID+'_'+x.value], ' '); SetValue('link_'+productID, link[productID+'_'+x.value], ' '); SetValue('compare_link_'+productID, compare[productID+'_'+x.value], ''); SetValue('compare2_link_'+productID, compare2[productID+'_'+x.value], ''); } function UpdatePrice2(productID, paramCount) { var x; var values = ''; for(var i=0; i"+pic+""); newWin.document.writeln(""); newWin.document.writeln(""); newWin.document.writeln("
"); newWin.document.writeln(""); newWin.document.writeln("
"); newWin.document.writeln(""); newWin.document.close(); newWin.focus(); } function open_admin_print(title, config_url) { var width = 800;//screen.availWidth-200; var height = 600;//screen.availHeight-100; x = (screen.availWidth-width)/2; y = (screen.availHeight-height)/2; if (x < 0) x = 0; if (y < 0) y = 0; newWin = window.open("",'admin_print','left='+x+',top='+y+',width='+width+',height='+height+',location="yes",menubar="no",status="no",toolbar="no",resizable="no",scrollbars="yes"'); newWin.moveTo(x,y); newWin.resizeTo(width,height); newWin.document.writeln(""+title+""); newWin.document.writeln(""); newWin.document.writeln(""); newWin.document.writeln(""); newWin.document.writeln(""); newWin.document.writeln(document.getElementById('main_div').innerHTML); newWin.document.writeln(""); newWin.document.close(); newWin.focus(); newWin.print(); } function open_map(addr, toolbars) { var map = new YMaps.Map(document.getElementById("YMapsID")); var gc = new YMaps.Geocoder(addr); YMaps.Events.observe(gc, gc.Events.Load, function () { if (this.length()) { map.setBounds(this.get(0).getBounds()); var geoResult = this.get(0).getBounds().getCenter(); var content = document.createElement('span'); content.innerHTML = addr; map.openBalloon(geoResult, content); } }); if (toolbars == 1) { var topLeftPos = new YMaps.ControlPosition(YMaps.ControlPosition.TOP_LEFT, new YMaps.Size(150, 15)), topRightPos = new YMaps.ControlPosition(YMaps.ControlPosition.TOP_RIGHT, new YMaps.Size(170, 15)), scaleLine = new YMaps.ScaleLine(), curPos = topLeftPos; map.addControl(scaleLine, curPos); map.addControl(new YMaps.TypeControl(), new YMaps.ControlPosition(YMaps.ControlPosition.TOP_LEFT)); map.addControl(new YMaps.Zoom()); map.addControl(new YMaps.MiniMap(), new YMaps.ControlPosition(YMaps.ControlPosition.TOP_RIGHT)); } } function popup_map(addr) { var width = screen.availWidth; var height = screen.availHeight; x = 0; y = 0; newWin = window.open("",'map','left='+x+',top='+y+',width='+width+',height='+height+',location="yes",menubar="no",status="no",toolbar="no",resizable="no",scrollbars="yes"'); newWin.moveTo(x,y); newWin.resizeTo(width,height); newWin.document.writeln(""+addr+""); newWin.document.writeln(""); newWin.document.writeln(""); newWin.document.writeln(""); newWin.document.writeln(""); newWin.document.writeln("
"); newWin.document.writeln(""); newWin.document.close(); newWin.focus(); } function confirmDelete(question, where) { temp = window.confirm(question); if (temp) { window.location=where; } } function WordCount(text) { words=text.split(" "); var count= words.length; if ((count > 1) && (words[count-1]=="")) count--; if ((count > 0) && (words[0]=="")) count--; return count; } var tooltip = { options: { attr_name: "tooltip", blank_text: "
(откроется в новом окне)", newline_entity: "
", max_width: 0, delay: 100, skip_tags: ["link", "style"] }, t: document.createElement("DIV"), c: null, g: false, canvas: null, m: function(e){ var x = window.event ? event.clientX + tooltip.canvas.scrollLeft : e.pageX; var y = window.event ? event.clientY + tooltip.canvas.scrollTop : e.pageY; mouseX = x; mouseY = y; CheckMenu(); if (tooltip.g){ tooltip.a(x, y); } }, d: function(){ tooltip.canvas = document.getElementsByTagName(document.compatMode && document.compatMode == "CSS1Compat" ? "HTML" : "BODY")[0]; tooltip.t.setAttribute("id", "tooltip"); document.body.appendChild(tooltip.t); if (tooltip.options.max_width) tooltip.t.style.maxWidth = tooltip.options.max_width + "px"; /* all but ie */ var a = document.all && !window.opera ? document.all : document.getElementsByTagName("*"); /* in opera 9 document.all produces type mismatch error */ var l = a.length; for (var i = 0; i < l; i++){ if (!a[i] || tooltip.options.skip_tags.in_array(a[i].tagName.toLowerCase())) continue; var tooltip_title = a[i].getAttribute("title"); /* returns form object if IE & name="title"; then IE crashes; so... */ if (tooltip_title && typeof tooltip_title != "string") tooltip_title = ""; var tooltip_alt = a[i].getAttribute("alt"); var tooltip_blank = a[i].getAttribute("target") && a[i].getAttribute("target") == "_blank" && tooltip.options.blank_text; if (tooltip_title){ a[i].setAttribute(tooltip.options.attr_name, tooltip_blank ? (tooltip_title ? tooltip_title + " " + tooltip.options.blank_text : tooltip.options.blank_text) : tooltip_title); if (a[i].getAttribute(tooltip.options.attr_name)){ a[i].removeAttribute("title"); if (tooltip_alt && a[i].complete) a[i].removeAttribute("alt"); tooltip.l(a[i], "mouseover", tooltip.s); tooltip.l(a[i], "mouseout", tooltip.h); } }else if (tooltip_alt && a[i].complete){ a[i].setAttribute(tooltip.options.attr_name, tooltip_alt); if (a[i].getAttribute(tooltip.options.attr_name)){ a[i].removeAttribute("alt"); tooltip.l(a[i], "mouseover", tooltip.s); tooltip.l(a[i], "mouseout", tooltip.h); } } if (!a[i].getAttribute(tooltip.options.attr_name) && tooltip_blank){ /* */ } } document.onmousemove = tooltip.m; window.onscroll = tooltip.h; tooltip.a(-99, -99); }, _: function(s){ s = s.replace(/\&/g,"&"); s = s.replace(/\/g,">"); return s; }, s: function(e){ if (typeof tooltip == "undefined") return; var d = window.event ? window.event.srcElement : e.target; if (!d.getAttribute(tooltip.options.attr_name)) return; var s = d.getAttribute(tooltip.options.attr_name); if (tooltip.options.newline_entity){ var s = tooltip._(s); s = s.replace(eval("/" + tooltip._(tooltip.options.newline_entity) + "/g"), "
"); tooltip.t.innerHTML = s; }else{ if (tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild); tooltip.t.appendChild(document.createTextNode(s)); } tooltip.c = setTimeout(function(){ tooltip.t.style.visibility = 'visible'; }, tooltip.options.delay); tooltip.g = true; }, h: function(e){ if (typeof tooltip == "undefined") return; tooltip.t.style.visibility = "hidden"; if (!tooltip.options.newline_entity && tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild); clearTimeout(tooltip.c); tooltip.g = false; tooltip.a(-99, -99); }, l: function(o, e, a){ if (o.addEventListener) o.addEventListener(e, a, false); /* was true--Opera 7b workaround! */ else if (o.attachEvent) o.attachEvent("on" + e, a); else return null; }, a: function(x, y){ var w_width = tooltip.canvas.clientWidth ? tooltip.canvas.clientWidth + tooltip.canvas.scrollLeft : window.innerWidth + window.pageXOffset; var w_height = window.innerHeight ? window.innerHeight + window.pageYOffset : tooltip.canvas.clientHeight + tooltip.canvas.scrollTop; /* should be vice verca since Opera 7 is crazy! */ if (document.all && document.all.item && !window.opera) tooltip.t.style.width = tooltip.options.max_width && tooltip.t.offsetWidth > tooltip.options.max_width ? tooltip.options.max_width + "px" : "auto"; var t_width = tooltip.t.offsetWidth; var t_height = tooltip.t.offsetHeight; tooltip.t.style.left = x + 0 + "px"; tooltip.t.style.top = y + 20 + "px"; if (x + t_width > w_width) tooltip.t.style.left = w_width - t_width + "px"; if (y + t_height > w_height) tooltip.t.style.top = w_height - t_height + "px"; } } Array.prototype.in_array = function(value){ var l = this.length; for (var i = 0; i < l; i++) if (this[i] === value) return true; return false; }; var root = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null; if (root){ if (root.addEventListener) root.addEventListener("load", tooltip.d, false); else if (root.attachEvent) root.attachEvent("onload", tooltip.d); }