
var Module=new Class({Binds:['send'],Implements:[Events],path:null,initialize:function(path){this.path=path;},send:function(args){return Module.doRequest(this.path,args);}});Module.doRequest=function(path,args){try{var result=new Request({url:path,async:false,evalScripts:false}).post(args);if(result.isSuccess())
return result.response.text;else return null;}catch(e){return null;}};var LoadIcon=new Class({initialize:function(element,message){message=message||"Loading...";if(element==undefined||element==null){element=new Element("span");}
element.set("html","<img src=\"common/load.gif\" alt=\"\" style=\"padding-right:10px\">"+message);return element;}});var previousHashFragment;var checkHashChanged=function(){var uri=new URI(window.location);var fragment=uri.get("fragment");if(fragment!=previousHashFragment){window.fireEvent("hashchanged",[fragment,previousHashFragment]);previousHashFragment=fragment;}
setTimeout("checkHashChanged()",200);}
setTimeout("checkHashChanged()",200);window.addEvent('domready',function(){$$(".tabbed-panel").each(function(el){try{new TabSwapper({selectedClass:'on',deselectedClass:'off',mouseoverClass:'over',mouseoutClass:'out',tabs:el.getElements(".tab"),sections:el.getElements(".section"),smooth:true});}catch(ex){}});$$('.sortable-table').each(function(t){new HtmlTable(t,{sortIndex:null,sortable:true});});$$(".validated").each(function(f){var validator=new Form.Validator(f,{scrollToErrorsOnSubmit:false});var m=f.getElement(".error-message");if(m)validator.addEvent("onElementValidate",function(isValid,field,className,warn){var v=validator.getValidator(className);if(!isValid&&v.getError(field)){m.set("html",v.getError(field));}else m.set("html","");});});$$(".validated-inline").each(function(f){new Form.Validator.Inline(f,{scrollToErrorsOnSubmit:false});});$$(".validation-tips").each(function(f){new FormValidator.Tips(f);});$$(".ajax-form").each(function(f){var m=f.getElement(".feedback-message")||f;new Form.Request(f,m,{resetForm:false});});$$(".scroller").each(function(f){var knob=f.getElement(".scrollKnob");var forward=f.getElement(".scrollForward");var backward=f.getElement(".scrollBack");var content=f.getElement(".content");new MooScroller(content,knob,{scrollLinks:{forward:forward,back:backward}});});$$(".carousel").each(function(c){var slides=c.getElements("a");new SimpleCarousel(c,slides,[],{slideInterval:6000,rotateAction:'click',crossFadeOptions:{duration:3000}});});});;var User=new Class({Extends:Module,Binds:['setUsername','setPassword','setEmail','setAdmin','setAdmin','addGroup','remove'],id:0,initialize:function(id){this.parent("modules/user/ajax/actions.php");this.id=id;},setUsername:function(username){return this.send({action:"setusername",username:username,user:this.id});},setFirstName:function(name){return this.send({action:"setfirstname",firstname:name,user:this.id});},setSurname:function(name){return this.send({action:"setsurname",surname:name,user:this.id});},setPassword:function(password){return this.send({action:"setpassword",password:password,user:this.id});},verifyLogin:function(password){return this.send({action:"verifylogin",password:password,user:this.id});},setEmail:function(email){return this.send({action:"setemail",email:email,user:this.id});},setAdmin:function(admin){return this.send({action:"setadmin",admin:admin,user:this.id});},addGroup:function(group){return this.send({action:"addusertogroup",group:group,user:this.id});},removeGroup:function(group){return this.send({action:"removeuserfromgroup",group:group,user:this.id});},getGroups:function(){return eval(this.send({action:"listgroupswithuser",user:this.id}));},remove:function(){return this.send({action:"deleteuser",user:this.id});}});User.getAll=function(){return eval(Module.doRequest("modules/user/ajax/actions.php",{action:"listusers"}));}
User.getAllUsernames=function(){var a=new Array();var u=User.getAll();u.each(function(user){a.push(user.username);});return a;}
User.sessionValid=function(){return Module.doRequest("modules/user/ajax/actions.php",{action:"validate"});}
User.exists=function(name){return Module.doRequest("modules/user/ajax/actions.php",{action:"exists",username:name});};window.addEvent("domready",function(){$$(".evo-module-registration").each(function(el){var form=el.getElement("form");var edit=el.getElement(".edit-details");var details=el.getElement(".edit-details-view");if(edit&&details){edit.getElement("a").addEvent("click",function(){edit.hide();details.reveal();});}
form.get("validator").add('validate-username-free',{errorMsg:'Sorry, that username is taken.',test:function(field){return User.exists(field.value)!="1";}});});});;window.addEvent("domready",function(){$$(".evo-module-login").each(function(el){var form=el.getElement(".login-form");var forgotform=el.getElement(".forgot-password");var forgot=el.getElement(".forgot-link");var got=el.getElement(".got-link");if(!(forgot&&forgotform&&form))return;forgotform.hide();forgot.setStyle("visibility","visible");forgot.addEvent("click",function(){form.dissolve().get("dissolve").chain(function(){forgotform.reveal();});});got.addEvent("click",function(){forgotform.dissolve().get("dissolve").chain(function(){form.reveal();});});});});;
