var cfe={};cfe.module={};cfe.addon={};cfe.base=new Class({version:"0.8.3",options:{scope:false,spacer:"gfx/spacer.gif",onInit:$empty,onInitSingle:$empty,onBeforeInitSingle:$empty,onSetModuleOption:$empty,onRegisterModule:$empty,onUnregisterModule:$empty,onComplete:$empty},modules:{},moduleOptions:{},moduleOptionsAll:{},initialize:function(a){this.options.debug=a|false;this.registerAllModules.bind(this)();},getVersion:function(){return this.version;},throwMsg:function(a){this.options.debug?alert(a):"";},registerAllModules:function(){$each(cfe.module,function(b,a){if(a!="generic"){this.registerModule(a);}}.bind(this));},registerModule:function(a){modObj=cfe.module[a];this.fireEvent("onRegisterModule",[a,modObj]);this.modules[a]=modObj;this.moduleOptions[a]={};return true;},registerModules:function(a){$each(a,function(b){this.registerModule(b);},this);},unregisterModule:function(a){modObj=cfe.module[a];this.fireEvent("onUnregisterModule",[a,modObj]);delete this.modules[a];},unregisterModules:function(a){$each(a,function(b){this.unregisterModule(b);},this);},setModuleOption:function(b,a,c){modObj=cfe.module[b];this.fireEvent("onSetModuleOption",[b,modObj,a,c]);if(!modObj){this.moduleOptionsAll[a]=c;}else{this.moduleOptions[b][a]=c;}},setModuleOptions:function(b,a){$each(a,function(d,c){this.setModuleOption(b,c,d);}.bind(this));},init:function(a){this.setOptions(this.options,a);if($type(this.options.scope)!="element"){this.options.scope=$(document.body);}this.fireEvent("onInit");$each(this.modules,function(e,c,d){var b=e.prototype.selector;this.options.scope.getElements(b).each(function(g,f){var h={instanceID:f,spacer:this.options.spacer};this.fireEvent("onBeforeInitSingle",[g,f,h]);var j=new e(g,$merge(h,$merge(this.moduleOptions[c],this.moduleOptionsAll)));this.fireEvent("onInitSingle",j);},this);},this);this.fireEvent("onComplete");}});cfe.base.implement(new Options,new Events);cfe.module.generic=new Class({type:"interface",options:{instanceID:0,spacer:false,aliasType:"span",onHover:Class.empty,onUnHover:Class.empty,onFocus:Class.empty,onBlur:Class.empty,onClick:Class.empty},initialize:function(b,a){this.setOptions(this.options,a);this.o=b.addEvents({focus:this.setFocus.bind(this),blur:this.removeFocus.bind(this)});this.o.store("cfe",this);this.initializeAdv.bind(this)();this.build.bind(this)();},initializeAdv:function(){this.procedeLabel.bind(this)();},procedeLabel:function(){this.implicitLabel=false;if(this.o.id){this.l=$$("label[for="+this.o.id+"]")[0];}if(!this.l){this.l=this.o.getParent("label");if($type(this.l)=="element"){this.implicitLabel=true;}}if(this.l){this.dontRemoveForFromLabel?"":this.l.removeProperty("for");this.l.addClass("for_"+(this.o.id||(this.o.name+this.o.value).replace("]","-").replace("[",""))+" js"+this.type+"L");this.l.addEvents({mouseover:this.hover.bind(this),mouseout:this.unhover.bind(this),click:this.clicked.bindWithEvent(this)});}else{return false;}},hideAndReplace:function(){this.o.setStyles({position:"absolute",left:"-999px"});if(Browser.Engine.trident){this.o.setStyles({position:"static",width:"0"});}this.a=new Element(this.options.aliasType,{"class":"js"+this.type+" js"+this.o.id,events:{mouseover:this.hover.bind(this),mouseout:this.unhover.bind(this),click:this.setFocus.bind(this)}}).setStyle("cursor","pointer").inject(this.o,"before");if(!this.implicitLabel){this.a.addEvent("click",this.clicked.bind(this));}},hover:function(){this.a.addClass("H");this.l?this.l.addClass("H"):"";this.fireEvent("onHover");},unhover:function(){this.a.removeClass("H");this.l?this.l.removeClass("H"):"";this.fireEvent("onUnHover");},setFocus:function(){this.a.addClass("F");this.l?this.l.addClass("F"):"";this.fireEvent("onFocus");},removeFocus:function(){this.a.removeClass("F");this.l?this.l.removeClass("F"):"";this.fireEvent("onBlur");},clicked:function(){this.o.focus();this.fireEvent("onClick");}});cfe.module.generic.implement(new Options,new Events);Element.Helpers=new Class({disableTextSelection:function(){if(Browser.Engine.trident||Browser.Engine.presto){this.setProperty("unselectable","on");}else{if(Browser.Engine.gecko){this.setStyle("MozUserSelect","none");}else{if(Browser.Engine.webkit){this.setStyle("KhtmlUserSelect","none");}}}}});Element.implement(new Element.Helpers);cfe.module.checkbox=new Class({Extends:cfe.module.generic,type:"Checkbox",selector:"input[type=checkbox]",initializeAdv:function(){this.parent();this.hideAndReplace.bind(this)();},build:function(){this.a.adopt(new Element("img",{src:this.options.spacer}));this.o.checked?this.a.addClass("A"):"";this.o.addEvent("keyup",this.toggleBySpace.bindWithEvent(this));},toggleBySpace:function(a){if(a.key=="space"){!this.o.checked?this.a.addClass("A"):this.a.removeClass("A");if(this.implicitLabel){this.o.checked=!this.o.checked;}}},unhover:function(){this.parent();this.a.removeClass(this.o.checked!=true?"A":"");},setStateTo:function(a){if(a){this.o.checked=true;this.a.addClass("A");this.fireEvent("onActive");}else{this.o.checked=false;this.a.removeClass("A");this.fireEvent("onInActive");}},clicked:function(){this.parent();this.setStateTo(this.o.checked?false:true);}});cfe.addon.selectCheckboxes=new Class({selectAll:function(a){(a||$(document.body)).getElements("input[type='checkbox']")[0].each(function(c,b){c.retrieve("cfe").setStateTo(true);});},deselectAll:function(a){(a||$(document.body)).getElements("input[type='checkbox']")[0].each(function(b){b.retrieve("cfe").setStateTo(false);});}});cfe.base.implement(new cfe.addon.selectCheckboxes);cfe.module.fieldset=new Class({Extends:cfe.module.generic,type:"Fieldset",selector:"fieldset",initializeAdv:function(){this.a=this.o;},build:function(){this.a.addEvents({mouseover:this.hover.bind(this),mouseout:this.unhover.bind(this),click:this.setFocus.bind(this)});window.addEvent("click",function(c){var d=new Event(c).stop();var a=this.a.getSize();var b=this.a.getPosition();if(d.page.x<b.x||d.page.x>b.x+a.size.x||d.page.y<b.y||d.page.y>b.y+a.size.y){this.removeFocus();}}.bind(this));},setFocus:function(){this.a.addClass("A");this.fireEvent("onFocus");},removeFocus:function(){this.a.removeClass("A");this.fireEvent("onBlur");}});cfe.module.file=new Class({Extends:cfe.module.generic,type:"File",selector:"input[type=file]",options:{fileIcons:true,trimFilePath:true},build:function(){this.a=new Element("div",{"class":"js"+this.type+"Wrapper",events:{mouseover:this.hover.bind(this),mouseout:this.unhover.bind(this),mousemove:this.follow.bindWithEvent(this)}}).setStyle("overflow","hidden").injectBefore(this.o).adopt(this.o);this.initO.bind(this)();this.v=new Element("div",{"class":"js"+this.type+"Path"}).inject(this.a,"after").addClass("hidden");this.options.fileIcons?this.fileIcon=new Element("img",{src:this.options.spacer}).inject(this.v):"";this.path=new Element("span",{"class":"filePath"}).inject(this.v);this.cross=new Element("img",{src:this.options.spacer,"class":"delete"}).addEvent("click",this.deleteCurrentFile.bind(this)).inject(this.v);this.updateFilePath.bind(this)();this.unhover.bind(this)();},initO:function(){this.o.addEvents({mouseout:this.updateFilePath.bind(this),change:this.updateFilePath.bind(this)});this.o.setStyles({cursor:"pointer",opacity:"0",visibility:"visible",height:this.a.getHeight(),width:"auto",position:"relative"});if(window.gecko){this.o.setStyle("MozOpacity","0");}},follow:function(b){var a=new Event(b);this.o.setStyle("left",(a.client.x-this.a.getLeft()-(this.o.getWidth()-30)));if(window.ie){if(a.client.x<this.a.getLeft()||a.client.x>this.a.getLeft()+this.a.getWidth()){this.o.setStyle("left",-999);}}},updateFilePath:function(){if(this.o.value!=""){var b=this.o.getProperty("value");b=this.options.trimFilePath?this.trimFilePath(b):b;this.path.set("html",b);if(this.options.fileIcons){var a=b.lastIndexOf(".");this.fileIcon.setProperty("class",b.substring(++a).toLowerCase());}this.v.removeClass("hidden");}else{this.path.set("html","");this.v.addClass("hidden");}},deleteCurrentFile:function(){var a=new Element("input",{type:"file","class":this.o.getProperty("class"),name:this.o.name,id:this.o.id});a.replaces(this.o);this.o=a;this.initO.bind(this)();this.updateFilePath.bind(this)();},trimFilePath:function(b){var a=false;if(!(a=b.lastIndexOf("\\"))){if(!(a=b.lastIndexOf("/"))){a=0;}}return b.substring(++a);}});cfe.module.image=new Class({type:"Image",noBuild:true,selector:"input[type=image]",initialize:function(b,a){this.setOptions(this.options,a);this.o=b.addEvents({mouseover:this.hover.bind(this),mouseout:this.unhover.bind(this),mousedown:this.press.bind(this),mouseup:this.release.bind(this)});this.boundRelease=this.release.bindWithEvent(this);},hover:function(){$chk(this.pressed)?this.press.bind(this)():this.hoverState.bind(this)();},unhover:function(){this.o.src=this.oSrc;},release:function(){this.o.src=this.oSrc;this.pressed=false;window.removeEvent("mouseup",this.boundRelease);},press:function(){if(!$chk(this.pressed)){this.pressed=true;this.o.src=this.oSrc;}this.pressState.bind(this)();window.addEvent("mouseup",this.boundRelease);},hoverState:function(){this.setState.attempt("H",this);},pressState:function(){this.setState.attempt("P",this);},setState:function(d){this.oSrc=this.o.src;var a=this.oSrc;var c=a.lastIndexOf(".");var b=a.substring(0,c)+d+a.substring(c);this.o.src=b;}});cfe.module.image.implement(new Options,new Events);cfe.module.password=new Class({Implements:cfe.module.text,type:"Password",selector:"input[type=password]"});cfe.module.radio=new Class({Extends:cfe.module.generic,type:"Radiobutton",selector:"input[type=radio]",initializeAdv:function(){this.parent();this.hideAndReplace.bind(this)();this.elName=this.o.getProperty("name").replace("]","").replace("[","-");},build:function(){this.a.addClass("cfe_radiogroup_"+this.elName).adopt(new Element("img",{src:this.options.spacer}));this.o.checked?this.a.addClass("A"):"";this.a.input=this.o;this.o.addEvent("keydown",this.toggleBySpace.bindWithEvent(this));},toggleBySpace:function(b){var a=new Event(b);a.key=="space"?this.clicked.bind(this)():"";},unhover:function(){this.parent();this.a.removeClass(!this.o.checked?"A":"");},clicked:function(){this.parent();$$(".cfe_radiogroup_"+this.elName).each(function(a){a.input.removeProperty("checked");a.removeClass(!a.input.checked?"A":"");}.bind(this));this.o.checked="true";this.a.addClass("A");}});cfe.module.select=new Class({Extends:cfe.module.generic,type:"Selector",selector:"select",options:{size:4,scrolling:true,scrollSteps:5},stdEvents:{mouseover:function(){this.addClass("H");},mouseout:function(){this.removeClass("H");},mousedown:function(){this.addClass("A");},mouseup:function(){this.removeClass("A");}},initializeAdv:function(){this.parent();this.hideAndReplace.bind(this)();this.origOptions=this.o.getChildren();this.preSelectedIndex=this.o.selectedIndex||0;this.kind=[];if(this.options.size>this.origOptions.length||this.options.scrolling!=true){this.options.size=this.origOptions.length;}this.boundKeyListener=this.keyListener.bindWithEvent(this);this.boundWheelListener=this.mouseListener.bindWithEvent(this);this.boundClickedOutsideListener=this.clickOutsideListener.bindWithEvent(this);},build:function(){var a=this.options.instanceID;this.a.addClass("jsSelector"+a);this.arrow=new Element("img",{"class":"js"+this.type+"Arrow",src:this.options.spacer,styles:{"float":"right",display:"inline"}}).injectInside(this.a);this.aWidth=this.a.getStyle("width").toInt();this.gfxWidth=this.arrow.getWidth();this.ai=new Element("span").addClass("js"+this.type+"Slide").injectInside(this.a).adopt(this.arrow);this.aWidth+=this.ai.getStyle("padding").toInt()*2;this.activeEl=new Element("span",{"class":"jsOption",styles:{"float":"left",display:"inline"}}).set("html",this.origOptions[0].get("text")).injectBefore(this.arrow);this.gfxHeight=this.a.getHeight()*this.options.size;this.container=new Element("div",{"class":"js"+this.type+"CWrapper js"+this.type+"CWrapper"+a,styles:{display:"none",overflow:"hidden"}}).injectAfter(this.a);this.cContent=new Element("div",{"class":"js"+this.type+"Content",styles:{"float":"left",display:"inline"}}).injectInside(this.container);this.aliasOptions=new Element("div",{"class":"js"+this.type+"C",styles:{height:this.gfxHeight,width:this.options.scrolling?(this.cContent.getStyle("width").toInt()-this.gfxWidth):"100%",overflow:"hidden","float":"left",display:"inline"}}).injectInside(this.cContent);this.origOptions.each(function(c,b){new Element("div",{"class":"jsOption jsOption"+b,styles:{"float":"left",width:"100%",clear:"left"},events:{mouseover:this.selectOption.pass([b,true,true],this),mouseout:this.selectOption.pass([b,true,true],this),click:this.selectOption.pass(b,this)}}).set("html",c.innerHTML).injectInside(this.aliasOptions);}.bind(this));this.aOptions=this.aliasOptions.getChildren();if(this.options.scrolling){this.scrollerWrapper=new Element("div",{"class":"js"+this.type+"ScrollerWrapper",styles:{height:this.gfxHeight,"float":"left",display:"inline"}}).injectInside(this.cContent);this.scrollerTop=new Element("img",{"class":"scrollTop",src:this.options.spacer,events:this.stdEvents}).addEvent("click",this.moveScoller.pass(-1*this.options.scrollSteps,this));this.scrollerBottom=new Element("img",{"class":"scrollBottom",src:this.options.spacer,events:this.stdEvents}).addEvent("click",this.moveScoller.pass(this.options.scrollSteps,this));this.scrollerWrapper.adopt(this.scrollerTop);if(typeof Browser.Engine.presto!="undefined"){this.scrollerBack=new Element("div").setStyle("height",this.gfxHeight-2*this.scrollerTop.getStyle("height").toInt()-20);}else{elementHeight=this.gfxHeight-2*this.scrollerTop.getStyle("height").toInt();if(elementHeight<0){elementHeight=0;}this.scrollerBack=new Element("div").setStyle("height",elementHeight);}this.scrollerKnob=new Element("img",{"class":"scrollKnob",src:this.options.spacer,events:this.stdEvents});this.scrollerBack.adopt(this.scrollerKnob);this.scrollerWrapper.adopt(this.scrollerBack).adopt(this.scrollerBottom);}this.selectOption.attempt(this.preSelectedIndex,this);},moveScoller:function(b){var a=this.aliasOptions.getScroll().y;this.slider.set(a+b<this.sliderSteps?a+b:this.sliderSteps);},selectOption:function(c,b,e,a){c=c.limit(0,this.origOptions.length-1);this.highlighted?this.highlighted.removeClass("H"):"";this.highlighted=this.aOptions[c];this.highlighted.addClass("H");this.highlightedID=c;if(a&&this.options.scrolling){this.scrollToSelectedItem(this.highlightedID);}if(e!=true){var d=this.origOptions[c];d.selected="selected";this.selectedID=c;this.activeEl.set("html",d.innerHTML);b?"":this.clicked.attempt("hide",this);}if(b!=true){this.fireEvent("change");}},scrollToSelectedItem:function(b,a){if(this.container.getStyle("display")=="block"){this.slider.set((this.sliderSteps/(this.aOptions.length-this.options.size))*b);}},selectOptionByKey:function(a){if(!this.kind[a]){this.kind[a]=[];this.origOptions.each(function(d,c){if(d.get("text").charAt(0).toLowerCase()==a){this.kind[a][this.kind[a].length]=c;}}.bind(this));}if($defined(this.kind[a][0])){var b=this.kind[a].indexOf(this.highlightedID);this.selectOption(this.kind[a][b+1]?this.kind[a][b+1]:this.kind[a][0],true,false,true);}},clicked:function(a){if(this.container.getStyle("display")=="block"||a=="hide"){this.container.setStyle("display","none");window.removeEvent("keyup",this.boundKeyListener);window.removeEvent("click",this.boundClickedOutsideListener);}else{this.parent();offsetLeft=this.a.offsetLeft;offsetTop=$$(".magura_form div.input_outer_layer").getTop();if($("tx_indexedsearch")){offsetTop=$$("#scroll_text").getTop();}this.container.setStyles({display:"block",position:"absolute",top:(this.a.getTop()-offsetTop[0]),left:offsetLeft,width:this.ai.getWidth()});if(Browser.Engine.trident){this.container.setStyles({});}if(this.options.scrolling){this.sliderSteps=this.aliasOptions.getScrollSize().y-(this.options.size*this.aliasOptions.getScrollSize().y/this.aOptions.length);this.slider=new Slider(this.scrollerBack,this.scrollerKnob,{steps:this.sliderSteps,mode:"vertical",onChange:function(b){this.aliasOptions.scrollTo(false,b);}.bind(this)}).set(0);this.scrollToSelectedItem(this.selectedID);}window.addEvent("click",this.boundClickedOutsideListener);}},keyListener:function(b){var a=new Event(b).stop();switch(a.key){case"up":this.scrollToSelectedItem(this.highlightedID-1,true);this.selectOption(this.highlightedID-1,true);break;case"down":this.scrollToSelectedItem(this.highlightedID+1,true);this.selectOption(this.highlightedID+1,true);break;case"enter":this.selectOption(this.highlightedID);break;default:this.selectOptionByKey(a.key);break;}},mouseListener:function(b){var a=new Event(b).stop();this.scrollToSelectedItem(this.highlightedID-a.wheel,true);this.selectOption(this.highlightedID-a.wheel,true);},clickOutsideListener:function(a){a=new Event(a).stop();if(!(this.a.hasChild(a.target)||this.container.hasChild(a.target)||this.l==a.target)){this.clicked("hide");}},setFocus:function(){this.parent();if(!this.hasFocusEvents){this.hasFocusEvents=true;window.addEvent("keyup",this.boundKeyListener);window.addEvent("mousewheel",this.boundWheelListener);}},removeFocus:function(){this.parent();if(this.hasFocusEvents){this.hasFocusEvents=false;window.removeEvent("keyup",this.boundKeyListener);window.removeEvent("mousewheel",this.boundWheelListener);}}});cfe.module.submit=new Class({Extends:cfe.module.generic,type:"Submit",options:{slidingDoors:true},selector:"input[type=submit]",initializeAdv:function(){this.hideAndReplace.bind(this)();this.boundRelease=this.release.bindWithEvent(this);this.boundToggleBySpace=this.toggleBySpace.bindWithEvent(this);},build:function(){this.a.addEvents({mousedown:this.press.bind(this),mouseup:this.boundRelease}).addClass("jsButton").adopt(this.o);this.o.addEvents({keydown:this.boundToggleBySpace,keyup:this.boundToggleBySpace});this.lab=new Element("span").addClass("label").set("html",this.o.value).inject(this.a);if($chk(this.options.slidingDoors)){this.slidingDoors=new Element("span",{"class":"js"+this.type+"Slide"}).inject(this.a);this.slidingDoors.adopt(this.o).adopt(this.lab);}this.lab.disableTextSelection();},unhover:function(){this.parent();this.a.removeClass("P");this.over=false;},toggleBySpace:function(a){if(a.key=="space"){switch(a.type){case"keyup":this.a.removeClass("H").removeClass("P");this.pressed=false;this.o.click();break;case"keydown":this.pressed=true;this.a.fireEvent("mouseover");}}},hover:function(){this.a.addClass(this.pressed?"P H":"H");this.over=true;},press:function(){if(!this.pressed){this.pressed=true;}this.a.addClass("P");window.addEvent("mouseup",this.boundRelease);},release:function(a){if(this.over&&(a.event.button==0||(Browser.Engine.trident&&a.event.button==1))){this.o.click();this.over=false;}else{window.removeEvent("mouseup",this.boundRelease);}this.a.removeClass("P");this.pressed=false;}});cfe.module.reset=new Class({Extends:cfe.module.submit,type:"Reset",selector:"input[type=reset]"});cfe.module.text=new Class({Extends:cfe.module.generic,type:"Text",selector:"input[type=text]",options:{slidingDoors:true},initializeAdv:function(){this.dontRemoveForFromLabel=true;this.parent();},build:function(){if($chk(this.options.slidingDoors)){this.slidingDoors=new Element("span",{"class":"js"+this.type+"Slide"}).inject(this.o,"before");if(Browser.Engine.trident){var a=new Element("span",{"class":"js"+this.type}).inject(this.slidingDoors);a.adopt(this.o);this.o.setStyles({background:"none",padding:0,margin:0});}else{this.slidingDoors.adopt(this.o);if(this.o.id){this.o.addClass("js"+this.o.id);}}this.a=this.slidingDoors;this.o.addClass("js"+this.type);}else{this.a=this.o;}this.a.addEvents({mouseover:this.hover.bind(this),mouseout:this.unhover.bind(this),click:this.clicked.bind(this)});}});cfe.module.textarea=new Class({Extends:cfe.module.text,type:"Textarea",selector:"textarea"});cfe.addon.dependencies=new Class({addDependencies:function(a,b){$each(b,function(c){this.addDependency(a,c);}.bind(this));return true;},addDependency:function(a,b){if($type(a.retrieve("deps"))!=="array"){a.store("deps",[]);}if($type(b)==="string"){b=$(b);}if($type(b)==="element"){a.retrieve("deps").push(b);return true;}return false;},getDependencies:function(a){return a.retrieve("deps");},attachDependencies:function(c,b,a){var d=this.getDependencies(c);if($type(d)==="array"){a.deps=d;return true;}return false;}});cfe.base.implement(new cfe.addon.dependencies);cfe.base.prototype.addEvent("onBeforeInitSingle",cfe.base.prototype.attachDependencies);cfe.addon.dependencies.modules=new Class({resolveDependencies:function(){var a=this.o.retrieve("deps");if(a){$each(a,function(c,b){c.retrieve("cfe").setStateTo(true);}.bind(this));}}});cfe.module.generic.implement(new cfe.addon.dependencies.modules);cfe.module.generic.prototype.addEvent("onActive",function(){this.resolveDependencies();});cfe.addon.toolTips=new Class({options:$merge(this.parent,{ttStyle:"label",ttClass:"jsQM"}),initToolTips:function(){if(!Tips&&this.options.debug){this.throwMsg.bind(this)("CustomFormElements: initialization of toolTips failed.\nReason: Mootools Plugin 'Tips' not available.");return false;}switch(this.options.ttStyle){default:case"label":this.toolTipsLabel.bind(this)();break;}},toolTipsLabel:function(){var a=this.options.scope.getElements("label");a.each(function(f,c){e=f.getProperty("for");if(!e){var b=f.getProperty("class");if(b){var e=b.match(/for_[a-zA-Z0-9\-]+/).toString();e=e.replace(/for_/,"");el=$(e);}if(!el){el=f.getElement("input");}}else{el=$(e);}if(el){if($chk(qmTitle=el.getProperty("title"))){el.setProperty("title","");var d=new Element("img",{src:this.options.spacer,"class":this.options.ttClass,title:qmTitle}).injectInside(f);}}},this);new Tips($$("."+this.options.ttClass+"[title]"));}});cfe.base.implement(new cfe.addon.toolTips);cfe.base.prototype.addEvent("onComplete",function(){this.initToolTips();});
