var ScriptConfigure=new Class({Implements:[Options],options:{formId:null,colors:null,others:null},initialize:function(A){this.setOptions(A);if(!$(this.options.formId)){return}this.start()},start:function(){if(this.options.colors){this.setColors()}if(this.options.others){this.setOthers()}},setColors:function(){this.colorPick=$(this.options.formId).getElements(this.options.colors);this.colorPick.each(function(B,A){new MooRainbow(B.get("id"),{imgPath:url+"/templates/images/moorainbow/",id:"MooRainbow_"+A,onChange:function(C){B.set({value:C.hex});$(B.get("rel")).setStyle(B.get("name").replace(B.get("rel")+"_",""),C.hex)},onComplete:function(){this.rewriteCode()}.bind(this)})}.bind(this))},setOthers:function(){this.others=$(this.options.formId).getElements(this.options.others);this.others.each(function(A){A.addEvent("change",function(){$(A.get("rel")).setStyle(A.get("name").replace(A.get("rel")+"_",""),A.get("value").toInt());this.rewriteCode()}.bind(this))}.bind(this));this.elements=this.colorPick.extend(this.others)},rewriteCode:function(){var A='<!-- start script curs valutar -->\n<script language="javascript" type="text/javascript">\n';this.elements.each(function(B){if(B.get("value")!==""){A+="var "+B.get("id")+" = '"+B.get("value")+"';\n"}});A+='<\/script>\n<script language="javascript" type="text/javascript" src="'+url+'/script_valutar.js"><\/script>\n<noscript><a href="'+url+'" title="Curs valutar BNR">Curs valutar</a></noscript>\n<!-- end script curs valutar -->';$("curs_valutar").set({value:A})}});
