function SpamCodeGetter(a){a=$(a);if(a==null)return false;a.value="";a.scg=this;$(a).observe("click",this.listen)}SpamCodeGetter.prototype.listen=function(a){var b=Event.findElement(a,"input");b!=null&&new Ajax.Request("http://"+document.location.host+"/exec/ajax/getcode.php",{method:"get",onSuccess:function(c){b.value=c.responseText}})};String.prototype.reverse=function(){for(var a=new String,b=this.length-1;b>-1;b--)a+=this.substr(b,1);return a.valueOf()};var SearchBox=Class.create();
SearchBox.prototype={start:true,initialize:function(a){var b=$(a),c=this;b!=null&&b.observe("focus",function(){if(c.start)b.value="";c.start=false})}};var CheckDisabler=Class.create();
CheckDisabler.prototype={elems:null,c:null,initialize:function(a,b){this.c=$(a);if(this.c!=null){this.elems=!Object.isString(b)?$$(b.join(",")):$$("#"+b+" input,#"+b+" select,#"+b+" textarea");this.c.observe("click",function(c){this.make(c)}.bind(this));this.makeDis()}},make:function(a){Event.findElement(a,"input")!=null&&this.makeDis()},makeDis:function(){var a=this.c;this.elems.each(function(b){b.disabled=!a.checked;if(b.type=="text"&&b.disabled)b.value=""})}};var ShClass=Class.create();
ShClass.prototype={elems:null,rClass:null,initialize:function(a,b,c){this.rClass=c;a=$(a);if(a!=null){a.showed=false;this.elems=$$("#"+b+" input,#"+b+" select,#"+b+" textarea");this.makeIt(!a.checked);a.observe("click",function(e){this.show(e)}.bind(this))}},show:function(a){a=Event.findElement(a,"input");if(a!=null){this.makeIt(a.showed);a.showed=!a.showed}},makeIt:function(a){var b=this.rClass;this.elems.each(function(c){a?c.removeClassName(b):c.addClassName(b)})}};var SwitchPhotos=Class.create();
SwitchPhotos.prototype={imgMed:[],imgThumb:[],initialize:function(a){a=$$("."+a+" img");if(a.length!=0){var b=null,c=this;a.each(function(e,d){var f=e.src.replace(/.+\/(.+\.jpg)/gi,"$1"),g=e.src.replace(/.+\/(.+\/)[a-z]+\/.+\.jpg/gi,"$1");c.imgMed[d]=new Image;c.imgMed[d].src="foto-product/"+g+"med/"+f;c.imgThumb[d]=new Image;c.imgThumb[d].src="foto-product/"+g+"thumb/"+f;d=$(e.parentNode);if(d.nodeName!="A")b=e;else{d.f=f;d.p=g;d.img=e;d.mImg=b;d.href="javascript:";d.observe("click",function(){var h=
this.mImg.src.replace(/.+\/(.+\.jpg)/gi,"$1");this.mImg.src="foto-product/"+this.p+"med/"+this.f;this.img.src="foto-product/"+this.p+"thumb/"+h;this.img.setStyle("display","inline");this.mImg.setStyle("display","inline");this.f=h}.bind(d))}})}}};
