var Behaviour={list:new Array,register:function(a){Behaviour.list.push(a)},start:function(){Behaviour.addLoadEvent(function(){Behaviour.apply()})},apply:function(){for(h=0;sheet=Behaviour.list[h];h++){for(selector in sheet){list=document.getElementsBySelector(selector);if(!list){continue}for(i=0;element=list[i];i++){sheet[selector](element)}}}},addLoadEvent:function(a){var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){try{if(typeof b=="function"){b()}}catch(c){}finally{}try{if(typeof a=="function"){a()}}catch(c){}finally{}}}}};Behaviour.start();function getAllChildren(a){return a.all?a.all:a.getElementsByTagName("*")}document.getElementsBySelector=function(x){if(!document.getElementsByTagName){return new Array()}var r=x.split(" ");var m=new Array(document);for(var z=0;z<r.length;z++){token=r[z].replace(/^\s+/,"").replace(/\s+$/,"");if(token.indexOf("#")>-1){var u=token.split("#");var d=u[0];var t=u[1];var b=document.getElementById(t);if(d&&b.nodeName.toLowerCase()!=d){return new Array()}m=new Array(b);continue}if(token.indexOf(".")>-1){var u=token.split(".");var d=u[0];var c=u[1];if(!d){d="*"}var o=new Array;var n=0;for(var A=0;A<m.length;A++){var p;if(d=="*"){p=getAllChildren(m[A])}else{p=m[A].getElementsByTagName(d)}for(var w=0;w<p.length;w++){o[n++]=p[w]}}m=new Array;var s=0;for(var v=0;v<o.length;v++){if(o[v].className&&o[v].className.match(new RegExp("\\b"+c+"\\b"))){m[s++]=o[v]}}continue}if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){var d=RegExp.$1;var y=RegExp.$2;var a=RegExp.$3;var q=RegExp.$4;if(!d){d="*"}var o=new Array;var n=0;for(var A=0;A<m.length;A++){var p;if(d=="*"){p=getAllChildren(m[A])}else{p=m[A].getElementsByTagName(d)}for(var w=0;w<p.length;w++){o[n++]=p[w]}}m=new Array;var s=0;var l;switch(a){case"=":l=function(k){return(k.getAttribute(y)==q)};break;case"~":l=function(k){return(k.getAttribute(y).match(new RegExp("\\b"+q+"\\b")))};break;case"|":l=function(k){return(k.getAttribute(y).match(new RegExp("^"+q+"-?")))};break;case"^":l=function(k){return(k.getAttribute(y).indexOf(q)==0)};break;case"$":l=function(k){return(k.getAttribute(y).lastIndexOf(q)==k.getAttribute(y).length-q.length)};break;case"*":l=function(k){return(k.getAttribute(y).indexOf(q)>-1)};break;default:l=function(k){return k.getAttribute(y)}}m=new Array;var s=0;for(var v=0;v<o.length;v++){if(l(o[v])){m[s++]=o[v]}}continue}if(!m[0]){return}d=token;var o=new Array;var n=0;for(var A=0;A<m.length;A++){var p=m[A].getElementsByTagName(d);for(var w=0;w<p.length;w++){o[n++]=p[w]}}m=o}return m};function open_printable_version(a){var b="menubar=no,location=no,resizable=yes,scrollbars=yes";newWin=window.open(a,"printableWin",b);if(newWin){newWin.focus()}}function confirmUnsubscribe(){temp=window.confirm(translate.cnfrm_unsubscribe);if(temp){window.location="index.php?killuser=yes"}}function validate(){if(document.subscription_form.email.value.length<1){alert(translate.err_input_email);return false}if(document.subscription_form.email.value=="Email"){alert(translate.err_input_email);return false}return true}function validate_disc(){if(document.formD.nick.value.length<1){alert(translate.err_input_nickname);return false}if(document.formD.topic.value.length<1){alert(translate.err_input_message_subject);return false}return true}function validate_search(){if(document.Sform.price1.value!=""&&((document.Sform.price1.value<0)||isNaN(document.Sform.price1.value))){alert(translate.err_input_price);return false}if(document.Sform.price2.value!=""&&((document.Sform.price2.value<0)||isNaN(document.Sform.price2.value))){alert(translate.err_input_price);return false}return true}function validate_input_digit(d){var l;var k;var c;try{if(window.event){l=window.event.keyCode}else{if(d.which){l=d.which}}}catch(b){alert(b.message)}l=parseInt(l);if(l==13){return false}if(l>=33&&l<=40){return true}if(l==8){return true}if(l==17){return true}if(l==45){return true}if(l==46){return true}if(l>=96&&l<=105){l-=48}k=String.fromCharCode(l);c=/\d/;return c.test(k);var a=c.test(k);return a}Behaviour.register({"input.input_message":function(a){a.onfocus=function(){this.className=this.className.replace(/input_message/,"")+" input_message_focus";var b=this.getAttribute("rel");if(!b){b=this.getAttribute("title")}if(this.value!=b){return}this.value=""};a.onblur=function(){if(this.value!=""){return}this.className=this.className.replace(/input_message_focus/,"")+" input_message";var b=this.getAttribute("rel");if(!b){b=this.getAttribute("title")}this.value=b}},".add2cart_handler":function(element){element.onclick=function(){var objForm=getFormByElem(this);if(!objForm){return true}var r_productParam=getElementsByClass("product_option",objForm);var query="";var in_detail=$(".product_qty").length;var r_productQty=1;if(in_detail){r_productQty=getElementByClass("product_qty",objForm);if(r_productQty){r_productQty=parseInt(r_productQty.value)}}if(r_productQty>0){query+="&product_qty="+r_productQty;for(var i=r_productParam.length-1;i>=0;i--){if(!parseInt(r_productParam[i].value)){continue}if(r_productParam[i].name){query+="&"+r_productParam[i].name+"="+parseInt(r_productParam[i].value)}}}if($("#lr1_"+objForm.getAttribute("rel")).is(":checked")||in_detail){var r_productQty=1;if(in_detail){r_productQty=getElementByClass("product_qty1",objForm);if(r_productQty){r_productQty=parseInt(r_productQty.value)}}if(r_productQty>0&&(in_detail||$("#lr1_"+objForm.getAttribute("rel")).is(":checked"))){query+="&product_qty1="+r_productQty;var r_productParam=getElementsByClass("product_option1",objForm);for(var i=r_productParam.length-1;i>=0;i--){if(!parseInt(r_productParam[i].value)){continue}if(r_productParam[i].name){query+="&"+r_productParam[i].name+"="+parseInt(r_productParam[i].value)}}}}var url=ORIG_LANG_URL+set_query("?ukey=cart&view=noframe&action=add_product&"+query+"&productID="+objForm.getAttribute("rel"),"");if($("#prod_"+objForm.getAttribute("rel"))&&$("#prod_"+objForm.getAttribute("rel")).length){var el=$("#prod_"+objForm.getAttribute("rel")).clone();el.appendTo($("#prodout_"+objForm.getAttribute("rel")));var oel=$("#prodout_"+objForm.getAttribute("rel"));var crt=$("#cart_block").offset();el.animate({top:"-="+(oel.offset().top-crt.top+20)+"px",left:"-="+(oel.offset().left-crt.left-50)+"px",opacity:0.2},"slow",null,function(){$(this).remove()});$("body,html").animate({scrollTop:0},"slow");el.find("img").animate({width:"50px"},"slow");$.get(url.replace("view=noframe","view=ajax"),function(data){var obj;eval("obj="+data);$("#shpcrtgc").html(obj.qty+" продукт(ов): ");$("#shpcrtca").html(obj.total+"Руб.")});return false}openFadeIFrame(url);return false}},".product_option":function(a){a.onchange=function(){var n=getFormByElem(this);if(!n){return true}var b=getElementsByClass("product_option",n);var l=parseFloat(getElementByClass("product_price",n).value);var k=0;var m=getElementByClass("product_list_price",n);if(m){k=parseFloat(m.value)}for(var c=b.length-1;c>=0;c--){var d=select_getCurrOption(b[c]);if(!d){continue}l+=parseFloat(d.getAttribute("rel"));k+=parseFloat(d.getAttribute("rel"))}getElementByClass("totalPrice",n).innerHTML=formatPrice(l);var m=getElementByClass("regularPrice",n);if(m){m.innerHTML=formatPrice(k)}var m=getElementByClass("youSavePrice",n);if(m){m.innerHTML=formatPrice(k-l)+" ("+Math.round((k-l)/k*100,2)+"%)"}}},".hndl_proceed_checkout_":function(a){a.onclick=function(){openFadeIFrame(ORIG_LANG_URL+set_query("?ukey=cart&view=noframe"));return false}},"input.goto":function(a){a.onclick=function(){if(this.className.search(/confirm/)!==-1&&!window.confirm(this.getAttribute("title"))){return}document.location.href=this.getAttribute("rel")}},".gofromfade":function(a){a.onclick=function(){parent.document.location.href=this.href;parent.closeFadeIFrame();return false}},"input.digit":function(a){a.onkeydown=function(b){return validate_input_digit(b)}},".product_remind":function(a){a.onclick=function(d){var l=getFormByElem(this);var k=getElementByClass("product_remind",l);var c=k.getAttribute("uid");if(c&&c>0){var b=ORIG_LANG_URL+set_query("?ukey=product_remind&view=noframe&action=remind&productID="+l.getAttribute("rel"));$.get(b);getElementByClass("product_remind_span_class",l).innerHTML="Вами отправлен<br/>запрос на уведомления"}else{sswgt_CartManager.shop_url=(window.WAROOT_URL!=null)?window.WAROOT_URL:ORIG_URL;sswgt_CartManager.showLayer(k.getAttribute("rel"),k.getAttribute("wnd_width"),k.getAttribute("wnd_height"))}return false}}});Behaviour.addLoadEvent(function(){var a=getElementsByClass("totalPrice");for(var b=a.length-1;b>=0;b--){var n=getFormByElem(a[b]);if(!n){continue}var o=getElementsByClass("product_option",n);var m=parseFloat(getElementByClass("product_price",n).value);var p=0;var c=getElementByClass("product_list_price",n);if(c){p=parseFloat(c.value)}for(var d=o.length-1;d>=0;d--){var l=select_getCurrOption(o[d]);if(!l){continue}m+=parseFloat(l.getAttribute("rel"));p+=parseFloat(l.getAttribute("rel"))}a[b].innerHTML=formatPrice(m);var c=getElementByClass("regularPrice",n);if(c){c.innerHTML=formatPrice(p)}var c=getElementByClass("youSavePrice",n);if(c){c.innerHTML=formatPrice(p-m)+" ("+Math.round((p-m)/p*100,2)+"%)"}}});$(document).ready(function(){$(".add2cart_handler").click(function(b){if($(".cpt_product_name h1").length){var a=$(".cpt_product_name h1").html();var c="product"}else{var a=$(this).parent().siblings(".prdbrief_name").children("a").html();var c="category"}_gaq.push(["_trackEvent","add2cart",c,a])});$("form [name]").blur(function(){var b=$(this).parents("form").attr("name");var a=$(location).attr("href");var c=$("title").html();_gaq.push(["_trackEvent","Form: "+b,c+" | "+a,$(this).attr("name"),$(this).val().length])});$(".formModal").click(function(k){k.preventDefault();var n=$(this).attr("href");var a=320;var m=290;var c=$(document).height();var l=$(document).width();$("#mask").css({width:l,height:c});$("#mask").fadeTo(200,0.5);$("#modal").css("width",a);$("#modal").css("height",m);var d=$(window).height();var b=$(window).width();$("#modal").css("left",b/2-a/2);$("#modal").css("top",d/2-m/2);$("#modal").slideDown(600);return false});$(".window .close").click(function(a){a.preventDefault();$("#mask, .window").hide()});$("#mask").click(function(){$(this).hide();$(".window").hide()});$(function(){var a=$("div.tabs > div");a.hide().filter(":first").show();$("div.tabs ul.tabNavigation a").click(function(){a.hide();a.filter(this.hash).show();$("div.tabs ul.tabNavigation a").removeClass("selected");$(this).addClass("selected");return false}).filter(":first").click()})});function getElementComputedStyle(b,c){if(typeof b!="object"){b=document.getElementById(b)}if(document.defaultView&&document.defaultView.getComputedStyle){if(c.match(/[A-Z]/)){c=c.replace(/([A-Z])/g,"-$1").toLowerCase()}return document.defaultView.getComputedStyle(b,"").getPropertyValue(c)}if(b.currentStyle){var a;while((a=c.indexOf("-"))!=-1){c=c.substr(0,a)+c.substr(a+1,1).toUpperCase()+c.substr(a+2)}return b.currentStyle[c]}return""}function getWindowSize(b){var a,c;if(b.innerHeight){if(b.document.documentElement.clientWidth){a=b.document.documentElement.clientWidth}else{b.windowWidth=b.innerWidth}c=b.innerHeight}else{if(b.document.documentElement&&b.document.documentElement.clientHeight){a=b.document.documentElement.clientWidth;c=b.document.documentElement.clientHeight}else{if(b.document.body){a=b.document.body.clientWidth;c=b.document.body.clientHeight}}}return[a,c]}function number_format(l,k,n,m){l=Math.round(l*Math.pow(10,k))/Math.pow(10,k);e=l+"";f=e.split(".");if(!f[0]){f[0]="0"}if(!f[1]){f[1]=""}if(f[1].length<k){g=f[1];for(i=f[1].length+1;i<=k;i++){g+="0"}f[1]=g}if(m!=""&&f[0].length>3){h=f[0];f[0]="";for(j=3;j<h.length;j+=3){i=h.slice(h.length-j,h.length-j+3);f[0]=m+i+f[0]+""}j=h.substr(0,(h.length%3==0)?3:(h.length%3));f[0]=j+f[0]}n=(k<=0)?"":n;return f[0]+n+f[1]}function getLayer(b,a){if(!a){a=window}if(a.document.getElementById){return a.document.getElementById(b)}if(a.document.all){return a.document.all[b]}if(a.document.layers){return a.document.layers[b]}return null}function changeState(a,c){var b=getLayer(a);if(is_null(b)){return}if(is_null(c)?b.style.display!="block":c){b.style.display="block"}else{b.style.display="none"}}function is_null(a){if(typeof(a)=="undefined"){return true}if(a==null){return true}return false}function getAbsolutePos(k){var a=0,d=0;var c=/^div$/i.test(k.tagName);if(c&&k.scrollLeft){a=k.scrollLeft}if(c&&k.scrollTop){d=k.scrollTop}var l={x:k.offsetLeft-a,y:k.offsetTop-d};if(k.offsetParent){var b=this.getAbsolutePos(k.offsetParent);l.x+=b.x;l.y+=b.y}return l}function getElementsByClass(l,b,o){var n=new Array();if(b==null){b=document}if(o==null){o="*"}var d=b.getElementsByTagName(o);var a=d.length;var m=new RegExp("(^|\\s)"+l+"(\\s|$)");for(var k=0,c=0;k<a;k++){if(m.test(d[k].className)){n[c]=d[k];c++}}return n}function getElementByClass(d,c,a){var b=getElementsByClass(d,c,a);if(!b.length){return null}return b[0]}function createTag(a,c,b){if(!b){b=window}if(!c){c=b.document.body}el=b.document.createElement(a);c.appendChild(el);return el}function deleteTag(a,b){if(!b){b=a.parentNode}b.removeChild(a)}function open_window(d,a,c){var k="width="+a+",height="+c+",menubar=no,location=no,resizable=yes,scrollbars=yes";var b=window.open(d,"newWin",k);if(b){b.focus()}return b}function select_getCurrValue(b){for(var a=0;a<b.options.length;a++){if(b.options[a].selected){return b.options[a].value}}return null}function select_getCurrOption(b){for(var a=0;a<b.options.length;a++){if(b.options[a].selected){return b.options[a]}}return null}function select_selectOptionByValue(b,c){for(var a=0;a<b.options.length;a++){b.options[a].selected=(c==b.options[a].value)}}function select_getOptionByValue(b,c){for(var a=0;a<b.options.length;a++){if(b.options[a].value==c){return b.options[a]}}return null}function findSelectedIndex(a){for(i=0;i<a.length;i++){if(a[i].selected){return i}}return -1}function select_addOption(l,k,b,d,a){var c=document.createElement("option");c.appendChild(document.createTextNode(k));c.setAttribute("value",b);if(d){c.defaultSelected=true}else{if(a){c.selected=true}}l.appendChild(c)}function confirmDelete(c,b,a){if(window.confirm(b)){window.location=a+c}}function formatPrice(price){return price+'Руб.'; /*defaultCurrency.getView(a)*/}function allowInsertAtCarret(a){return document.selection||(a.selectionStart||a.selectionStart=="0")||false}function insertAtCarret(l,d){if(document.selection){l.focus();sel=document.selection.createRange();sel.text=d}else{if(l.selectionStart||l.selectionStart=="0"){var b=l.selectionStart;var a=l.selectionEnd;var k=l.scrollTop;l.value=l.value.substring(0,b)+d+l.value.substring(a,l.value.length);l.focus();var c=b+(d.length);l.selectionStart=c;l.selectionEnd=c;l.scrollTop=k}else{l.value+="\n"+d}}if(l.createTextRange){l.caretPos=document.selection.createRange().duplicate()}}FadeSteps=["ff","ee","dd","cc","bb","aa","99"];FadeTimeout=600;function fadeBlock(a){DoFade(FadeSteps.length-1,a)}function DoFade(b,a){if(b>=0&&document.getElementById(a)){document.getElementById(a).style.backgroundColor="#ffff"+FadeSteps[b];b--;setTimeout("DoFade("+b+",'"+a+"')",FadeTimeout)}else{if(document.getElementById(a).getAttribute("obj_wnd")){document.getElementById(a).getAttribute("obj_wnd").close()}}}function __alert(a){var b=new Message();b.__type=MSGTYPE_SUCCESS;b.__message=a;b.showMessage()}var MSGTYPE_SUCCESS=1;var MSGTYPE_ERROR=2;var Message=function(){this.__type=null;this.__code=null;this.__message=null;this.__params=null;this.init=function(a){if(a.type){this.__type=a.type}if(a.code){this.__code=a.code}if(a.message){this.__message=a.message}if(a.params){this.__params=a.params}};this.isError=function(){return this.__type==MSGTYPE_ERROR};this.isSuccess=function(){return this.__type==MSGTYPE_SUCCESS};this.getMessage=function(){return this.__message};this.getParams=function(){return this.__params};this.showMessage=function(){var a=new wnd();a.move(100,100);a.setWidth(400);var b=a.getContentObj();b.className=this.isSuccess()?"success_block":"error_block";b.innerHTML=this.getMessage();b.id="wnd-msg-block";b.style.position="fixed";w_size=getWindowSize(window);w1_size=a.getSize();a.move((w_size[0]-w1_size[0])/2,(w_size[1]-w1_size[1])/4);a.show();a.fade()}};var wnd=function(){if(getLayer("wnd-init")){this.__objDiv=getLayer("wnd-init");this.__objDiv.parentNode.removeChild(this.__objDiv)}this.__objDiv=createTag("div");this.__objDiv.id="wnd-init";this.__objDiv.className="wnd_init";this.__objDiv.setAttribute("obj_wnd",this);var a=this;this.__objContent=createTag("div",this.__objDiv);this.fade=function(){setTimeout("getLayer('"+this.__objDiv.id+"').style.display = 'none'",5000)};this.getSize=function(){return[this.__objDiv.offsetWidth,this.__objDiv.offsetHeight]};this.getContentObj=function(){return this.__objContent};this.setWidth=function(b){this.__objDiv.style.width=b+"px"};this.setHeight=function(b){this.__objDiv.style.height=b+"px"};this.show=function(){this.__objDiv.style.visibility="visible"};this.hide=function(){this.__objDiv.style.visibility="hidden"};this.close=function(){this.hide();this.__objDiv.parentNode.removeChild(this.__objDiv)};this.move=function(b,c){this.__objDiv.style.left=b+"px";this.__objDiv.style.top=c+"px"}};function getFormByElem(b){var a=50;var c=b.parentNode;while(c&&c.tagName&&!(/^form$/i.test(c.tagName))&&0<a--){c=c.parentNode}if(c&&c.tagName&&/^form$/i.test(c.tagName)){return c}return null}function getCookie(c){var d=document.cookie.indexOf(c+"=");var a=d+c.length+1;if((!d)&&(c!=document.cookie.substring(0,c.length))){return null}if(d==-1){return null}var b=document.cookie.indexOf(";",a);if(b==-1){b=document.cookie.length}return unescape(document.cookie.substring(a,b))}function setCookie(c,k,a,n,d,m){var b=new Date();b.setTime(b.getTime());if(a){a=a*1000*60*60*24}var l=new Date(b.getTime()+(a));document.cookie=c+"="+escape(k)+((a)?"; expires="+l.toGMTString():"")+((n)?"; path="+n:"")+((d)?"; domain="+d:"")+((m)?"; secure":"")}function deleteCookie(a,c,b){if(getCookie(a)){document.cookie=a+"="+((c)?";path="+c:"")+((b)?";domain="+b:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT"}}function catchResult(a){alert(a)}function openFadeIFrame(b,a){sswgt_CartManager.shop_url=(window.WAROOT_URL!=null)?window.WAROOT_URL:ORIG_URL;sizes=getPageSize();sswgt_CartManager.show(b,sizes[0]*0.7,sizes[1]*0.7)}function resizeFadeIFrame(b,a){sswgt_CartManager.resizeFrame(b,a)}function closeFadeIFrame(){sswgt_CartManager.hide()}function split_query(d){var k=d.split(/\&/);var a={};var c=null;for(var b=k.length-1;b>=0;b--){c=k[b].split(/\=/);if(c[0]!=null){a[c[0]]=c[1]?c[1]:""}}return a}function set_query(p,a){if(!a){a=document.location.href}var c=/([^\?]*)\?([^\#]*)(|\#.*)$/;var m=a.match(c);var q=m&&m[1]?m[1]:"";var r=m&&m[2]?m[2]:"";var b=m&&m[3]?m[3]:"";var n=p.search(/^\?/)==-1?"update":"new";p=p.replace(/^\?|^\&/,"");var o=split_query(p);var d=split_query(r);var s="";if(n=="update"){for(var l in o){d[l]=o[l]?o[l]:null}}else{for(var l in o){if(!o[l]){o[l]=d[l]?d[l]:null}}d=o}for(var l in d){if(l&&(d[l]!=null)){s+="&"+l+"="+d[l]}}return"?"+s.replace(/^\&/,"")+b}var AjaxCptHndls={__handlers:{},register:function(c,a,b){if(is_null(this.__handlers[a])){this.__handlers[a]={}}this.__handlers[a][c]=b},call:function(c,a,b){if(is_null(this.__handlers[a][c])){return}return this.__handlers[a][c](b)}};function getEventObject(b){var a={};b=b?b:window.event;if(b.srcElement){a.target=b.srcElement}else{a.target=b.target}a.ev=b;return a}function getPageSize(){var c,a;if(window.innerHeight&&window.scrollMaxY){c=window.innerWidth+window.scrollMaxX;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}var b,d;if(self.innerHeight){if(document.documentElement.clientWidth){b=document.documentElement.clientWidth}else{b=self.innerWidth}d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=c}else{pageWidth=b}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize}var beforeUnloadHandler_contentChanged=false;var beforeUnloadHandler=function(){if(beforeUnloadHandler_contentChanged){return translate.msg_unsaved_changes}if(window.tinyMCE){var a=false;for(var c in tinyMCE.instances){var b=tinyMCE.instances[c];if(!tinyMCE.isInstance(b)){continue}if(b.isDirty()){return translate.msg_unsaved_changes}}}return};function getCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return null}function setCookie(b,c,a){var d=new Date();d.setDate(d.getDate()+a);document.cookie=b+"="+escape(c)+((a==null)?"":";expires="+d.toGMTString())}window.onbeforeunload=beforeUnloadHandler;function submitProductsComparison(){var d=getFormByElem(this);var b=getElementsByClass("ctrl_products_cmp");var c=getElementByClass("comparison_products",d);c.value="";for(var a=b.length-1;a>=0;a--){if(!b[a].checked){continue}c.value+=" "+b[a].value}if(c.value!=""){d.submit()}}Behaviour.register({"input.hndl_submit_prds_cmp":function(a){a.onclick=submitProductsComparison}});function rate_hover(ye) {if(ye == 1){$('.unit-rating').css({'display' : 'block'});$('.rate_note').css({'display' : 'block'});$('.golos_note').css({'display' : 'none'});}else{$('.unit-rating').css({'display' : 'none'});$('.rate_note').css({'display' : 'none'});$('.golos_note').css({'display' : 'block'});}return false;}
if(!sswgt_CartManager){
var sswgt_CartManager = {
'prefix': 'my_',
'mode': 'frame',
'add2cart': function(objA){
this.shop_url = objA.getAttribute('rel');
sizes = getPageSize();
this.show(objA.href+'&widgets=1', sizes[2]*0.7, sizes[3]*0.7);
return false;
},
'go2cart': function(objA){
this.shop_url = objA.getAttribute('rel');
sizes = getPageSize();
this.show(objA.href, sizes[2]*0.7, sizes[3]*0.7);
return false;
},
'_show': function(width, height){
this.hide(true);
hideSelectBoxes();
hideFlash();
this.div();
this.base();
if(this.mode == 'frame'){
this.frame(this.params.url, width, height);
}else if(this.mode == 'layer'){
this.layer(this.params.layer_id, width, height);
}
this.border(this.objMain);
this.closeButton(this.objBorder);
var old_onresize= window.onresize;
window.onresize = function(){
with(sswgt_CartManager){
if(!(objOverlay && objDiv)){return;}
var arrayPageSize = getPageSize();
objOverlay.style.width = arrayPageSize[2]+'px';
objOverlay.style.height = arrayPageSize[3]+'px';
objBase.style.width = arrayPageSize[2]+'px';
objBase.style.height = arrayPageSize[3]+'px';
if(sswgt_CartManager.mode == 'frame'){
sswgt_CartManager.frame(null, frameWidth, frameHeight);
}else{ if(sswgt_CartManager.mode == 'layer'){
sswgt_CartManager.layer(sswgt_CartManager.params.layer_id, frameWidth, frameHeight);
}}
border(sswgt_CartManager.objMain);
closeButton(objBorder);
};
if(old_onresize){old_onresize();}
};
var old_onkeydown = document.onkeydown;
document.onkeydown = function (event){
event = event?event:window.event;
if(event){
switch (event.keyCode ? event.keyCode : event.which ? event.which : null){
case 0x1B: sswgt_CartManager.hide(true);
}}
if(old_onkeydown){old_onkeydown();}
};
},
'showLayer': function(layer_id, width, height){
this.mode = 'layer';
this.params = {'layer_id': layer_id};
this._show(width, height);
showSelectBoxes();
},
'show': function(url, width, height){
this.mode = 'frame';
this.params = {'url': url};
this._show(width, height);
},
'resizeFrame': function(width, height){
if(width != null){this.frameWidth = width;}
if(height != null){this.frameHeight = height;}
this.frame(null, this.frameWidth, this.frameHeight);
this.border(this.objFrame);
this.closeButton(this.objBorder);
},
'div': function(){
this.objDiv = document.createElement('div');
setStyle(this.objDiv, 'zIndex:100; position: absolute; left:0; top: 0;');// background:url("n.gif") no-repeat; backgroundAttachment:fixed');
var objBody = document.getElementsByTagName("body").item(0);
objBody.appendChild(this.objDiv);
this.objDiv.style.backgroundAttachment = 'fixed';
},
'layer': function(layer_id, width, height){
var objLayer = getLayer(layer_id);
setStyle(objLayer,'visibility:hidden; display: block');
if(!width){width = objLayer.offsetWidth;}
if(!height){height = objLayer.offsetHeight;}
this.frameWidth = width;
this.frameHeight = height;
var page = getPageSize();
var left = (page[2] - width)/2;
if(left<0){left=0;}
var top = (page[3] - height)/2;
if(top<10){top=10;}
this.objBase.appendChild(objLayer);
setStyle(objLayer, 'top:'+top+'px; left:'+left+'px; width:'+width+'px; height:'+height+'px;overflow: auto;zIndex:121; position:absolute;visibility:visible');
this.objBase.style.visibility = 'visible';
this.objMain = objLayer;
},
'frame': function(url, width, height){
this.frameWidth = width;
this.frameHeight = height;
var page = getPageSize();
var left = parseInt((page[2] - width)/2);if(left<0){left=0;}
var top = parseInt((page[3] - height)/2);if(top<10){top=10;}
var objFrame = document.getElementById(this.prefix+'frame');
if(!objFrame){
var objT = document.createElement('div');
objT.style.display = 'none';
objT.innerHTML = '<iframe id="'+this.prefix+'frame" frameborder="0"></iframe>';
this.objBase.appendChild(objT);
objFrame = document.getElementById(this.prefix+'frame');
this.objBase.appendChild(objFrame);
this.objBase.removeChild(objT);
setStyle(objFrame, 'zIndex:120; position:absolute; backgroundColor:#ffffff');
var objLoading = document.createElement('div');
this.objBase.appendChild(objLoading);
setStyle(objLoading, 'backgroundColor:#ffffff; zIndex:121; position:absolute; padding:20px; left:'+parseInt(page[2]/2-50+20)+'px; top:'+parseInt(page[3]/2-50)+'px;visibility: visible;');
var objImgLoading = document.createElement('img');
//objImgLoading.src = this.shop_url+'published/SC/html/scripts/images_common/loading.gif';
objImgLoading.src = ((window.CONF_ON_WEBASYST||(this.shop_url.search('webasyst.net')!=-1))?(this.shop_url.replace(/shop\//,'')+'shop/'):(this.shop_url+'published/SC/html/scripts/'))+'images_common/loading.gif';
objLoading.appendChild(objImgLoading);
setTimeout(
function(){
objFrame.src = url;
}
,100);
var objBase = this.objBase;
function objFrame_onload(){
if(objFrame.style.visibility != 'visible'){
var objLoading1 = objLoading;
var objBase1 = objBase;
setTimeout(function(){
if(objLoading1 && objLoading1.parentNode){
objLoading1.parentNode.removeChild(objLoading1);
objLoading1 = null;
}
objBase1.style.visibility = 'visible';}, 800);
}
};
if (objFrame.addEventListener) objFrame.addEventListener("load",objFrame_onload,false);
else if (objFrame.attachEvent) objFrame.attachEvent("onload", objFrame_onload);
this.objFrame = objFrame;
this.objMain = this.objFrame;
}
setStyle(objFrame, 'top:'+top+'px; left:'+left+'px; width:'+width+'px; height:'+height+'px');
},
'base': function(){
if(!/MSIE/.test(navigator.userAgent)){
var objBase = document.createElement("div");
objBase.style.visibility = 'hidden';
}else{
this.objDiv.innerHTML += '<div'+' id="myBase" style=\'z-index:95; position:absolute; visibility:hidden; top: expression(parseInt(document.documentElement.scrollTop || document.body.scrollTop, 10)+"px"); left: expression(parseInt(document.documentElement.scrollLeft || document.body.scrollLeft, 10)+"px");\'></div>';
var objBase = document.getElementById('myBase');
}
setStyle(objBase, 'zIndex:95');
if(!/MSIE/.test(navigator.userAgent)||/MSIE 8/.test(navigator.userAgent)){setStyle(objBase, 'top:0; left:0; position: fixed');}
var arrayPageSize = getPageSize();
objBase.style.width = arrayPageSize[2]+'px';
objBase.style.height = arrayPageSize[3]+'px';
objBase.onclick = function(ev){if(getEventObject(ev).target.id && getEventObject(ev).target.id == this.id){sswgt_CartManager.hide(true);}};
this.objDiv.insertBefore(objBase, this.objDiv.firstChild);
this.objBase = objBase;
this.overlay();
},
'overlay':function(){
var objOverlay = document.getElementById(this.prefix+'overlay');
if(!objOverlay){
objOverlay = document.createElement('div');
objOverlay.id = this.prefix+'overlay';
this.objBase.appendChild(objOverlay);
}
 
var left = 0;
var top = 0;
var width = this.objBase.offsetWidth;
var height = this.objBase.offsetHeight;
setStyle(objOverlay, 'position:absolute; visibility: visible; top:'+top+'; left:'+left+'; width:'+width+'px; height:'+height+'px; backgroundColor:#000000');
setOpacity(objOverlay, 0.7);
objOverlay.onclick = function(ev){if(getEventObject(ev).target.id && getEventObject(ev).target.id == this.id){sswgt_CartManager.hide(true);}};
this.objOverlay = objOverlay;
},
'hide': function(remove){
if(this.objDiv && this.objDiv.parentNode){
if(this.objOverlay){
this.objDiv.appendChild(this.objOverlay);
}
this.objDiv.style.display = "none";
if(remove){
if(this.mode == 'layer'){
setStyle(this.objMain, 'display:none');
setStyle(this.objMain, 'visibility:hidden');
document.body.appendChild(this.objMain);
}
this.objDiv.parentNode.removeChild(this.objDiv);
this.objDiv = null;
this.objOverlay = null;
}
showSelectBoxes();
showFlash();
}
},
'closeButton': function(parentObject){
with(this){
var objCloseButton = document.getElementById(prefix+'closeButton');
if(!objCloseButton){
objCloseButton = document.createElement('img');
objCloseButton.id = prefix+'closeButton';
}
var objFrame =this.objFrame||document.getElementById(this.prefix+'frame');
//TODO check it
/*
var left = parentObject.offsetLeft+parentObject.offsetWidth-22;
var top = parentObject.offsetTop-25;
*/
if(objFrame){
var left = objFrame.offsetLeft+objFrame.offsetWidth-22;
var top = objFrame.offsetTop-25;
 setStyle(objCloseButton, 'position:absolute; top:'+top+'px; left:'+left+'px; cursor:hand;');//cursor:pointer; 
//DEBUG:
//alert(this.shop_url);
//objCloseButton.src = ((window.CONF_ON_WEBASYST||(this.shop_url.search('webasyst.net')!=-1))?(this.shop_url.replace(/shop\//,'')):(this.shop_url+'published/SC/html/scripts/'))+'images_common/close.gif';
objCloseButton.src = ((window.CONF_ON_WEBASYST||(this.shop_url.search('webasyst.net')!=-1))?(this.shop_url.replace(/shop\//,'')+'shop/'):(this.shop_url+'published/SC/html/scripts/'))+'images_common/close.gif';
//objCloseButton.src = this.shop_url+'published/SC/html/scripts/images_common/close.gif';
objCloseButton.onclick = function(){sswgt_CartManager.hide(true);return false;};
objBase.appendChild(objCloseButton);
}
};
},
'border': function(parentObj){
var objBorder = document.getElementById(this.prefix+'border');
if(!objBorder){
objBorder = document.createElement('div');
objBorder.id = this.prefix+'border';
this.objBase.appendChild(objBorder);
}
var border_width = 0;
var left = parseInt(parentObj.style.left,10)-border_width;
var top = parseInt(parentObj.style.top,10)-border_width;
var width = parentObj.offsetWidth;
var height = parentObj.offsetHeight;
if(/MSIE/.test(navigator.userAgent)){
width += border_width*2;
height += border_width*2;
}
setStyle(objBorder, 'position:absolute; top:'+top+'; left:'+left+'; width:'+width+'px; height:'+height+'px; border: '+border_width+'px solid #efefef');
this.objBorder = objBorder;
}
};
function showSelectBoxes(){
var selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "visible";
}
}
function hideSelectBoxes(){
var selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
if(!selects[i].className.match(/div_fade_select/)){
selects[i].style.visibility = "hidden";
}
}
}
function showFlash(){
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++) {
flashObjects[i].style.visibility = "visible";
}
var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++) {
flashEmbeds[i].style.visibility = "visible";
}
}
function hideFlash(){
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++) {
flashObjects[i].style.visibility = "hidden";
}
var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++) {
flashEmbeds[i].style.visibility = "hidden";
}
}
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {// all except Explorer
if(document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth; 
} else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;} else if (document.body) { // other ExplorerswindowWidth = document.body.clientWidth;windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else { 
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = xScroll;
} else {
pageWidth = windowWidth;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
return arrayPageSize;
}
function setOpacity(element, value){
if (value == 1){
element.style.opacity = (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : null;
if(/MSIE/.test(navigator.userAgent)){
element.style.filter = element.style.filter.replace(/alpha\([^\)]*\)/gi, '');
 }
} else {
if(value < 0.00001){ value = 0;}
element.style.opacity = value;
if(/MSIE/.test(navigator.userAgent)){
element.style.filter = element.style.filter.replace(/alpha\([^\)]*\)/gi, '')+ 'alpha(opacity='+value*100+')';
}
} 
}
function setStyle(obj, style_str){
var styles = style_str.split(";");
with(obj){
for(var k=styles.length-1; k>=0; k--){
var _style = styles[k].split(':', 2);
if(!_style[1]){continue;}
_style[0] = _style[0].replace(/^\s|\s$/, '');
_style[1] = _style[1].replace(/^\s|\s$/, '');
style[_style[0]] = _style[1];
}
};
}
function getEventObject(ev){
var my_ev = {};
ev = ev?ev:window.event;
if(ev.srcElement){
my_ev.target = ev.srcElement;
}else{
my_ev.target = ev.target;
}
my_ev.ev = ev;
return my_ev;
}
}

