function Registration(request,regcode,submitBtn){this.submit=submitBtn;this.uri=request;this.ajax=null;this.reg=regcode;this.isCreated=false;this.ajaxresponse=function(){if(this.responseStatus[0]==200||this.responseStatus[1]=="OK"){var responseArray=this.response.split("|");var thisObj=this.controller;thisObj.isCreated=true;if(responseArray.length==3){if(responseArray[1]=="alert"){alert(responseArray[2]);}else if(responseArray[1]=="print"){printMsg(responseArray[2],null,'#ff9900');}else if(responseArray[1]=="redirect"){window.location.replace(responseArray[2]);}else if(responseArray[1]=="refresh"){thisObj.reg.sendIRequest();printMsg(responseArray[2],null,'#ff9900');}}}};this.sendRequest=function(email,username,password,cEmail,cPassword,code){this.ajax=new sack(this.uri);this.ajax.setVar("username",username);this.ajax.setVar("password",password);this.ajax.setVar("email",email);this.ajax.setVar("cPassword",cPassword);this.ajax.setVar("cEmail",cEmail);this.ajax.setVar("code",code);this.ajax.setVar("proc_class","nfm.core.entity.ajax.AJAXNewUser");this.ajax.method="POST";this.ajax.controller=this;this.ajax.onCompletion=this.ajaxresponse;this.ajax.runAJAX();};this.clickSubmitHandler=function(evt){var thisObj=this;if(evt){var source=et_findEventSource(evt,true);thisObj=source.controller;}var uin=document.getElementById('username');var ein=document.getElementById('email');var pin=document.getElementById('password');var cpin=document.getElementById('confirmPassword');var cein=document.getElementById('confirmEmail');var code=thisObj.reg.getValue();if(!code||code.length!=4){printMsg("The security code must be 4 characters long",null,'#ff9900');return;}if(!uin.value||uin.value.length<4){printMsg("The username must be at least 4 characters long",null,'#ff9900');return;}if(!pin.value||pin.value.length<5){printMsg("The password must be at least 5 characters long",null,'#ff9900');return;}if(!ein.value||ein.value.length<7){printMsg("The email address must be at least 7 characters long",null,'#ff9900');return;}if(ein.value!=cein.value){printMsg("The email and confirm email fields do not match",null,'#ff9900');return;}if(pin.value!=cpin.value){printMsg("The password and confirm password fields do not match",null,'#ff9900');return;}thisObj.isCreated=false;thisObj.showSubmitMessage(0);thisObj.sendRequest(ein.value,uin.value,pin.value,cein.value,cpin.value,code);};this.clickCloseHandler=function(evt){close();};this.showSubmitMessage=function(numDots){if(!this.isCreated){var msg='Creating account';for(var i=0;i<5;i++){if(i<numDots)msg+='.';else msg+='&nbsp';}printMsg(msg,null,'#ff9900');var thisObj=this;var nextDots=(numDots<4)?(numDots+1):0;window.setTimeout(function(){thisObj.showSubmitMessage(nextDots)},400);}};this.initialize=function(){if(!document.getElementById(this.submit)){var thisObj=this;window.setTimeout(function(){thisObj.initialize()},100);return;}et_setupLink(this.submit,this,this.clickSubmitHandler);};this.initialize();}