var FormularList=new Class({Implements:[Options,Events],options:{targetContainer:null,dropDown:null,indicator:null,onLoaded:$empty},initialize:function(B,A){this.setOptions(A);this.form=B;if(!this.checkBase()&&GBrowserIsCompatible()){return false}this.setup()},checkBase:function(){if(!this.form||this.form.get("action").clean()==""){alert("Required formular action is null or the formular can not be found");return false}if(!this.options.targetContainer){alert("Required option 'targetContainer' is null or the relevant element can not be found");return false}if(!this.options.dropDown){alert("Required option 'dropDown' is null or the relevant element can not be found");return false}return true},setup:function(){var A=this;this.url=this.form.getProperty("action").clean();this.form.addEvent("submit",function(B){B.stop()});this.options.dropDown.addEvents({"change":this.load.bind(this),"reset":function(){this.selectedIndex=0}});this.request_flag=false;this.load()},load:function(){if(!this.request_flag){this.id=this.options.dropDown.getSelectedValue();if(this.id=="-1"||this.id=="0"){this.options.dropDown.fireEvent("reset")}else{this.setDropDown(false);this.setIndicator(true);this.setContainer(false);this.request_flag=true;var B=this;var A=new Request({url:B.url+"&id="+B.id,onSuccess:function(C){B.updateGui(C)},onFailure:function(){B.showFailure()}}).send()}}},updateGui:function(A){this.request_flag=false;var B=this;this.options.targetContainer.innerHTML=A;this.setIndicator(false);this.setDropDown(true);this.setContainer(true);this.fireEvent("onLoaded")},showFailure:function(){this.options.targetContainer.set("text","Fehler: Die Anfrage ist schief gegangen.");this.setDropDown(true);this.setIndicator(false);this.setContainer(true)},setDropDown:function(A){this.options.dropDown.setStyle("visibility",(A)?"visible":"hidden")},setIndicator:function(A){this.options.indicator.setStyle("display",(A)?"block":"none")},setContainer:function(A){if(A){this.options.targetContainer.setStyle("display","block")}else{this.options.targetContainer.setStyle("display","none");this.options.targetContainer.set("text","")}}})
