function Cart(a,f,b,d,e,j,h,g){this.table="cart";this.form=$(a);this.formTry=($(a+"_"))?$(a+"_"):"";this.submit=($(f))?$(f):"";this.s_login=($(b))?$(b):"";this.p_login=($(d))?$(d):"";this.refreshImgs.call(this);this.order_form=($(e))?$(e):"";this.order_submit=($(j))?$(j):"";this.cart_count=$(h);this.cart_price=$(g);this.statistic=$("div_summary");this.product_cart=$("product_cart");var c=this;if(this.submit){Element.observe(this.submit,"click",function(){c.form.submit();});}if($(f+"_")){Element.observe($(f+"_"),"click",function(){c.formTry.submit();});}if(this.s_login){Element.observe(this.s_login,"keypress",this.sendForm.bindAsEventListener(this));}if($(b+"_")){Element.observe($(b+"_"),"keypress",this.sendFormTry.bindAsEventListener(this));}if(this.p_login){Element.observe(this.p_login,"keypress",this.sendForm.bindAsEventListener(this));}if($(d+"_")){Element.observe($(d+"_"),"keypress",this.sendFormTry.bindAsEventListener(this));}if(this.order_form){Element.observe(this.order_submit,"click",function(){c.order_form.submit();});}}Cart.prototype.sendForm=function(a){if(a.keyCode!=13){return false;}this.form.submit();};Cart.prototype.sendFormTry=function(a){if(a.keyCode!=13){return false;}this.formTry.submit();};Cart.prototype.refreshImgs=function(){var d=this;var c=$$("img.add_to_cart");if(c){c.each(function(a){Element.observe(a,"click",d.addToCart.bind(d,a));});}var b=$$("span.add_to_cart");if(b){b.each(function(a){Element.observe(a,"click",d.addToCart.bind(d,a));});}var c=$$("img.cartImgDel");if(c){c.each(function(a){Element.observe(a,"click",d.delFromCart.bind(d,a));});}var c=$$("input.productCount");if(c){c.each(function(a){Element.observe(a,"change",d.setCount.bind(d,a));});}};Cart.prototype.addToCart=function(el){var obj=this;var id_product=el.readAttribute("id_product");var id_pp=el.readAttribute("id_pp");var price=el.readAttribute("price");if(!id_product){id_product=el.id.split("_")[1];}el.stopObserving("click");var req=new Ajax.Request("/control/save.php",{parameters:{table:this.table,id:id_product,id_pp:id_pp,price:price,type:"add"},onComplete:pasteIt});function pasteIt(t){if(el.tagName=="SPAN"){el.removeClassName("in_the_cart");el.addClassName("in_the_cart");el.stopObserving("click");}else{var x=el.src.split("/");var name=x.pop();var src=x.join("/")+"/"+name.split(".")[0]+"_."+name.split(".")[1];el.src=src;}var o=eval("("+t.responseText+")");obj.updateInfo.call(obj,o);}};Cart.prototype.setCount=function(el){var obj=this;var id_product=el.readAttribute("id_product");var id_pp=Number(el.readAttribute("id_pp"));var idf=el.id.split("_")[1];var price=$("productprice_"+idf).innerHTML;var sum=Math.round(Number(price)*Number(el.value));var req=new Ajax.Request("/control/save.php",{parameters:{table:this.table,id:id_product,id_pp:id_pp,count:el.value,type:"set"},onComplete:pasteIt});function pasteIt(t){var o=eval("("+t.responseText+")");obj.updateInfo.call(obj,o);$("productsum_"+idf).update(sum);}};Cart.prototype.updateInfo=function(a){if(a==null){a={count:0,price:0};}this.cart_count.update(a["count"]);if($(this.cart_count.id+"1")){$(this.cart_count.id+"1").update(a["count"]);}this.cart_price.update(a["price"]);if($(this.cart_price.id+"1")){$(this.cart_price.id+"1").update(a["price"]);}};Cart.prototype.delFromCart=function(el){var obj=this;var id_product=el.readAttribute("id_product");var id_pp=el.readAttribute("id_pp");if(!id_product){id_product=el.id.split("_")[1];}el.stopObserving("click");var req=new Ajax.Request("/control/save.php",{parameters:{table:this.table,id:id_product,id_pp:id_pp,type:"del"},onComplete:pasteIt});function pasteIt(t){el.parentNode.parentNode.parentNode.remove();var o=eval("("+t.responseText+")");if(!obj.product_cart.childElements().length){obj.statistic.remove();}obj.updateInfo.call(obj,o);}};function FilterShow(){var a=this;$$("div.div_search_panel span.opt_name").each(function(c){var e=c.id.split("_")[1];if(!e){return false;}var b=$("filterC_"+e);Element.observe(c,"click",a.showhide.bindAsEventListener(b));});$$("div.div_search_panel div.opt_name img").each(function(b){var d=b.id.split("_")[1];var c=$("desc_"+d);Element.observe(b,"click",a.showhideOption.bindAsEventListener(c,b));});}FilterShow.prototype.showhide=function(b,a){if(!Object.isElement(this)){return true;}if(this.visible()){this.hide();}else{this.show();}};FilterShow.prototype.showhideOption=function(c,b){var e=b.id.split("_")[1];if(!e){return false;}var a=this.getWidth()*-1;if(Prototype.Browser.IE){var d=b.positionedOffset();this.setStyle({left:d[0]+a,top:d[1]+10});}else{this.clonePosition(b,{setWidth:false,setHeight:false,offsetLeft:a,offsetTop:10});}if(this.visible()){this.hide();}else{this.show();}};Event.observe(window,"load",function(){var b=new Cart("login_form","submit_form","login","password","order_form","orderIt","cart_count","cart_price");var a=new FilterShow();});startList=function(){if(document.all&&document.getElementById){navRoot=document.getElementById("navigation");for(i=0;i<navRoot.childNodes.length;i++){node=navRoot.childNodes[i];if(node.nodeName=="LI"){node.onmouseover=function(){this.className+=" over";};node.onmouseout=function(){this.className=this.className.replace(" over","");};}}}};Event.observe(window,"load",function(){startList();});function Resize(){var a=1;this.rows=[];while($$("td.displayNone_"+a).length==0&&a<10){a++;}while($$("td.displayNone_"+a).length>0){this.rows[this.rows.length+1]=$$("td.displayNone_"+a);a++;}Element.observe(window,"resize",this.onResize.bindAsEventListener(this));this.onResize.call(this);}Resize.prototype.onResize=function(){var d=window.innerWidth;var e=6;if(!d){d=document.documentElement.clientWidth;}if(d<800){e=1;}else{if(d>800&&d<1000){e=2;}else{if(d>1000&&d<1200){e=3;}else{if(d>1200&&d<1400){e=4;}else{e=5;}}}}var a=100/e;wd=a+"%";$$("td.titleTd").each(function(f){f.setStyle({width:wd});});if(Prototype.Browser.IE){for(var b in this.rows){var c=1;if(Object.isArray(this.rows[b])){this.rows[b].each(function(f){if(c<=e){f.show();}else{f.hide();}c++;});}}return true;}this.rows.each(function(g){var f=1;g.each(function(h){if(f<=e){h.show();}else{h.hide();}f++;});});return true;};Element.observe(window,"load",function(){var a=new Resize();});
