if(typeof(Control)=="undefined")
 Control={};
Control.Modal=Class.create();
Object.extend(Control.Modal,{
 loaded:false,
 loading:false,
 loadingTimeout:false,
 overlay:false,
 container:false,
 current:false,
 ie:false,
 effects:{
 containerFade:false,
 containerAppear:false,
 overlayFade:false,
 overlayAppear:false
},
 targetRegexp:/#(.+)$/,
 imgRegexp:/\.(jpe?g|gif|png|tiff?)$/i,
 overlayStyles:{
 position:'absolute',
 top:0,
 left:0,
 width:'100%',
 height:'100%',
 zIndex:9998
},
 overlayIEStyles:{
 position:'absolute',
 top:0,
 left:0,
 zIndex:9998
},
 disableHoverClose:false,
 load:function(){
 if(!Control.Modal.loaded){
 Control.Modal.loaded=true;
 Control.Modal.ie=!(typeof document.body.style.maxHeight!='undefined');
 Control.Modal.overlay=$(document.createElement('div'));
 Control.Modal.overlay.id='modal_overlay';
 Object.extend(Control.Modal.overlay.style,Control.Modal['overlay'+(Control.Modal.ie?'IE':'')+'Styles']);
 Control.Modal.overlay.hide();
 Control.Modal.container=$(document.createElement('div'));
 Control.Modal.container.id='modal_container';
 Control.Modal.container.hide();
 Control.Modal.loading=$(document.createElement('div'));
 Control.Modal.loading.id='modal_loading';
 Control.Modal.loading.hide();
 var body_tag=document.getElementsByTagName('body')[0];
 body_tag.appendChild(Control.Modal.overlay);
 body_tag.appendChild(Control.Modal.container);
 body_tag.appendChild(Control.Modal.loading);
 Control.Modal.container.observe('mouseout',function(event){
 if(!Control.Modal.disableHoverClose&&Control.Modal.current&&Control.Modal.current.options.hover&&!Position.within(Control.Modal.container,Event.pointerX(event),Event.pointerY(event)))
 Control.Modal.close();
});
}
},
 open:function(contents,options){
 options=options||{};
 if(!options.contents)
 options.contents=contents;
 var modal_instance=new Control.Modal(false,options);
 modal_instance.open();
 return modal_instance;
},
 close:function(force){
 if(typeof(force)!='boolean')
 force=false;
 if(Control.Modal.current)
 Control.Modal.current.close(force);
},
 attachEvents:function(){
 Event.observe(window,'load',Control.Modal.load);


},
 center:function(element){
 if(!element._absolutized){
 element.setStyle({
 position:'absolute'
});
 element._absolutized=true;
}
 var dimensions=element.getDimensions();
 Position.prepare();
 var offset_left=(Position.deltaX+Math.floor((Control.Modal.getWindowWidth()-dimensions.width)/2));
 var offset_top=(Position.deltaY+((Control.Modal.getWindowHeight()>dimensions.height)?Math.floor((Control.Modal.getWindowHeight()-dimensions.height)/2):0));
 element.setStyle({
 top:((dimensions.height<=Control.Modal.getDocumentHeight())?((offset_top!=null&&offset_top>0)?offset_top:'0')+'px':0),
 left:((dimensions.width<=Control.Modal.getDocumentWidth())?((offset_left!=null&&offset_left>0)?offset_left:'0')+'px':0)
});
},
 getWindowWidth:function(){
 return(self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0);
},
 getWindowHeight:function(){
 return(self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0);
},
 getDocumentWidth:function(){
 return Math.min(document.body.scrollWidth,Control.Modal.getWindowWidth());
},
 getDocumentHeight:function(){
 return Math.max(document.body.scrollHeight,Control.Modal.getWindowHeight());
},
 onKeyDown:function(event){
 if(event.keyCode==Event.KEY_ESC)
 Control.Modal.close();
}
});
Object.extend(Control.Modal.prototype,{
 mode:'',
 html:false,
 href:'',
 element:false,
 src:false,
 imageLoaded:false,
 ajaxRequest:false,
 initialize:function(element,options){
 this.element=$(element);
 this.options={
 beforeOpen:Prototype.emptyFunction,
 afterOpen:Prototype.emptyFunction,
 beforeClose:Prototype.emptyFunction,
 afterClose:Prototype.emptyFunction,
 onSuccess:Prototype.emptyFunction,
 onFailure:Prototype.emptyFunction,
 onException:Prototype.emptyFunction,
 beforeImageLoad:Prototype.emptyFunction,
 afterImageLoad:Prototype.emptyFunction,
 autoOpenIfLinked:true,
 contents:false,
 loading:false,
 fade:false,
 fadeDuration:0.75,
 image:false,
 imageCloseOnClick:true,
 hover:false,
 iframe:false,
 iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0" id="#{id}" name="#{id}" allowTransparency="true"></iframe>'),
 evalScripts:true,
 requestOptions:{},
 overlayDisplay:true,
 overlayClassName:'',
 overlayCloseOnClick:true,
 containerClassName:'',
 opacity:0.3,
 zIndex:9998,
 width:null,
 height:null,
 offsetLeft:0,
 offsetTop:0,
 position:'absolute'
};
 Object.extend(this.options,options||{});
 var target_match=false;
 var image_match=false;
 if(this.element){
 target_match=Control.Modal.targetRegexp.exec(this.element.href);
 image_match=Control.Modal.imgRegexp.exec(this.element.href);
}
 if(this.options.position=='mouse')
 this.options.hover=true;
 if(this.options.contents){
 this.mode='contents';
}else if(this.options.image||image_match){
 this.mode='image';
 this.src=this.element.href;
}else if(target_match){
 this.mode='named';
 var x=$(target_match[1]);
 this.html=x.innerHTML;
 x.remove();
 this.href=target_match[1];
}else{
 this.mode=(this.options.iframe)?'iframe':'ajax';
 this.href=this.element.href;
}
 if(this.element){
 if(this.options.hover){
 this.element.observe('mouseover',this.open.bind(this));
 this.element.observe('mouseout',function(event){
 if(!Position.within(Control.Modal.container,Event.pointerX(event),Event.pointerY(event)))
 this.close();
}.bindAsEventListener(this));
}else{
 this.element.onclick=function(event){
 this.open();
 Event.stop(event);
 return false;
}.bindAsEventListener(this);
}
}
 var targets=Control.Modal.targetRegexp.exec(window.location);
 this.position=function(event){
 if(this.options.position=='absolute')
 Control.Modal.center(Control.Modal.container);
 else{
 var xy=(event&&this.options.position=='mouse'?[Event.pointerX(event),Event.pointerY(event)]:Position.cumulativeOffset(this.element));
 Control.Modal.container.setStyle({
 position:'absolute',
 top:xy[1]+(typeof(this.options.offsetTop)=='function'?this.options.offsetTop():this.options.offsetTop)+'px',
 left:xy[0]+(typeof(this.options.offsetLeft)=='function'?this.options.offsetLeft():this.options.offsetLeft)+'px'
});
}
 if(Control.Modal.ie){
 Control.Modal.overlay.setStyle({
 height:Control.Modal.getDocumentHeight()+'px',
 width:Control.Modal.getDocumentWidth()+'px'
});
}
}.bind(this);
 if(this.mode=='named'&&this.options.autoOpenIfLinked&&targets&&targets[1]&&targets[1]==this.href)
 this.open();
},
 showLoadingIndicator:function(){
 if(this.options.loading){
 Control.Modal.loadingTimeout=window.setTimeout(function(){
 var modal_image=$('modal_image');
 if(modal_image)
 modal_image.hide();
 Control.Modal.loading.style.zIndex=this.options.zIndex+1;
 Control.Modal.loading.update('<img id="modal_loading" src="'+this.options.loading+'"/>');
 Control.Modal.loading.show();
 Control.Modal.center(Control.Modal.loading);
}.bind(this),250);
}
},
 hideLoadingIndicator:function(){
 if(this.options.loading){
 if(Control.Modal.loadingTimeout)
 window.clearTimeout(Control.Modal.loadingTimeout);
 var modal_image=$('modal_image');
 if(modal_image)
 modal_image.show();
 Control.Modal.loading.hide();
}
},
 open:function(force){
 if(!force&&this.notify('beforeOpen')===false)
 return;
 if(!Control.Modal.loaded)
 Control.Modal.load();
 Control.Modal.close();
 if(!this.options.hover)
 Event.observe($(document.getElementsByTagName('body')[0]),'keydown',Control.Modal.onKeyDown);
 Control.Modal.current=this;
 if(!this.options.hover)
 Control.Modal.overlay.setStyle({
 zIndex:this.options.zIndex,
 opacity:this.options.opacity
});
 Control.Modal.container.setStyle({
 zIndex:this.options.zIndex+1,
 width:(this.options.width?(typeof(this.options.width)=='function'?this.options.width():this.options.width)+'px':null),
 height:(this.options.height?(typeof(this.options.height)=='function'?this.options.height():this.options.height)+'px':null)
});
 if(Control.Modal.ie&&!this.options.hover){
 $A(document.getElementsByTagName('select')).each(function(select){
 select.style.visibility='hidden';
});
}
 Control.Modal.overlay.addClassName(this.options.overlayClassName);
 Control.Modal.container.addClassName(this.options.containerClassName);
 switch(this.mode){
 case'image':
 this.imageLoaded=false;
 this.notify('beforeImageLoad');
 this.showLoadingIndicator();
 var img=document.createElement('img');
 img.onload=function(img){
 this.hideLoadingIndicator();
 this.update([img]);
 if(this.options.imageCloseOnClick)
 $(img).observe('click',Control.Modal.close);
 this.position();
 this.notify('afterImageLoad');
 img.onload=null;
}.bind(this,img);
 img.src=this.src;
 img.id='modal_image';
 break;
 case'ajax':
 this.notify('beforeLoad');
 var options={
 method:'post',
 onSuccess:function(request){
 this.hideLoadingIndicator();
 this.update(request.responseText);
 this.notify('onSuccess',request);
 this.ajaxRequest=false;
}.bind(this),
 onFailure:function(){
 this.notify('onFailure');
}.bind(this),
 onException:function(){
 this.notify('onException');
}.bind(this)
};
 Object.extend(options,this.options.requestOptions);
 this.showLoadingIndicator();
 this.ajaxRequest=new Ajax.Request(this.href,options);
 break;
 case'iframe':
 this.update(this.options.iframeTemplate.evaluate({href:this.href,id:'modal_iframe'}));
 break;
 case'contents':
 this.update((typeof(this.options.contents)=='function'?this.options.contents():this.options.contents));
 break;
 case'named':
 this.update(this.html);
 break;
}
 if(!this.options.hover){
 if(this.options.overlayCloseOnClick&&this.options.overlayDisplay)
 Control.Modal.overlay.observe('click',Control.Modal.close);
 if(this.options.overlayDisplay){
 if(this.options.fade){
 if(Control.Modal.effects.overlayFade)
 Control.Modal.effects.overlayFade.cancel();
 Control.Modal.effects.overlayAppear=new Effect.Appear(Control.Modal.overlay,{
 queue:{
 position:'front',
 scope:'Control.Modal'
},
 to:this.options.opacity,
 duration:this.options.fadeDuration/2
});
}else
 Control.Modal.overlay.show();
}
}
 if(this.options.position=='mouse'){
 this.mouseHoverListener=this.position.bindAsEventListener(this);
 this.element.observe('mousemove',this.mouseHoverListener);
}
 this.notify('afterOpen');
},
 update:function(html){
 if(typeof(html)=='string')
 Control.Modal.container.update(html);
 else{
 Control.Modal.container.update('');
(html.each)?html.each(function(node){
 Control.Modal.container.appendChild(node);
}):Control.Modal.container.appendChild(node);
}
 if(this.options.fade){
 if(Control.Modal.effects.containerFade)
 Control.Modal.effects.containerFade.cancel();
 Control.Modal.effects.containerAppear=new Effect.Appear(Control.Modal.container,{
 queue:{
 position:'end',
 scope:'Control.Modal'
},
 to:1,
 duration:this.options.fadeDuration/2
});
}else
 Control.Modal.container.show();
 this.position();
 Event.observe(window,'resize',this.position,false);
 Event.observe(window,'scroll',this.position,false);
},
 close:function(force){
 if(!force&&this.notify('beforeClose')===false)
 return;
 if(this.ajaxRequest)
 this.ajaxRequest.transport.abort();
 this.hideLoadingIndicator();
 if(this.mode=='image'){
 var modal_image=$('modal_image');
 if(this.options.imageCloseOnClick&&modal_image)
 modal_image.stopObserving('click',Control.Modal.close);
}
 if(Control.Modal.ie&&!this.options.hover){
 $A(document.getElementsByTagName('select')).each(function(select){
 select.style.visibility='visible';
});
}
 if(!this.options.hover)
 Event.stopObserving(window,'keyup',Control.Modal.onKeyDown);
 Control.Modal.current=false;
 Event.stopObserving(window,'resize',this.position,false);
 Event.stopObserving(window,'scroll',this.position,false);
 if(!this.options.hover){
 if(this.options.overlayCloseOnClick&&this.options.overlayDisplay)
 Control.Modal.overlay.stopObserving('click',Control.Modal.close);
 if(this.options.overlayDisplay){
 if(this.options.fade){
 if(Control.Modal.effects.overlayAppear)
 Control.Modal.effects.overlayAppear.cancel();
 Control.Modal.effects.overlayFade=new Effect.Fade(Control.Modal.overlay,{
 queue:{
 position:'end',
 scope:'Control.Modal'
},
 from:this.options.opacity,
 to:0,
 duration:this.options.fadeDuration/2
});
}else
 Control.Modal.overlay.hide();
}
}
 if(this.options.fade){
 if(Control.Modal.effects.containerAppear)
 Control.Modal.effects.containerAppear.cancel();
 Control.Modal.effects.containerFade=new Effect.Fade(Control.Modal.container,{
 queue:{
 position:'front',
 scope:'Control.Modal'
},
 from:1,
 to:0,
 duration:this.options.fadeDuration/2,
 afterFinish:function(){
 Control.Modal.container.update('');
 this.resetClassNameAndStyles();
}.bind(this)
});
}else{
 Control.Modal.container.hide();
 Control.Modal.container.update('');
 this.resetClassNameAndStyles();
}
 if(this.options.position=='mouse')
 this.element.stopObserving('mousemove',this.mouseHoverListener);
 this.notify('afterClose');
},
 resetClassNameAndStyles:function(){
 Control.Modal.overlay.removeClassName(this.options.overlayClassName);
 Control.Modal.container.removeClassName(this.options.containerClassName);
 Control.Modal.container.setStyle({
 height:null,
 width:null,
 top:null,
 left:null
});
},
 notify:function(event_name){
 try{
 if(this.options[event_name])
 return[this.options[event_name].apply(this.options[event_name],$A(arguments).slice(1))];
}catch(e){
 if(e!=$break)
 throw e;
 else
 return false;
}
}
});
if(typeof(Object.Event)!='undefined')
 Object.Event.extend(Control.Modal);
Control.Modal.attachEvents();

var TimeZoneHelper={
	load:function(countryEl,tzEl,callback){
		TimeZoneHelper.countryEl=$(countryEl);
		TimeZoneHelper.tzEl=$(tzEl);
		TimeZoneHelper.onCountryChangeCallback=callback;
		
		TimeZoneHelper.onCountryChange(null,true);
		
		TimeZoneHelper.countryEl.observe('change',TimeZoneHelper.onCountryChange);

	},

	onCountryChange:function(e,skipCallback){
		skipCallback=skipCallback||false;
		
		TimeZoneHelper.tzEl.update('');
		var zones=COUNTRY_CODE_TO_TIME_ZONES.get(TimeZoneHelper.countryEl.value);
		var options=zones.map(function(zone){
			var tzId=zone[0];
			var tzName=zone[1];
			var gmtOffset=TIME_ZONE_TO_CURRENT_OFFSET.get(tzId);
			if(tzName != "-----"){
				var formattedOffset=(gmtOffset>=0)?"+"+gmtOffset/3600:gmtOffset/3600;
				var text1 = " (GMT ";
				var test2 = ")";
			}else{ formattedOffset = "";var text1 = "";var test2 = "";}
			
				return opt=new Element('option',{value:tzId,gmtOffset:gmtOffset}).update(tzName+text1+formattedOffset+test2);//my add ,'selected'
		});
		options.each(function(opt){
			TimeZoneHelper.tzEl.insert({top:opt});
		});
		//TimeZoneHelper.options[4].selected = true;
		TimeZoneHelper.tzEl.down('option').selected=true;
		if((typeof(TimeZoneHelper.onCountryChangeCallback)=="function")&&!skipCallback){
			TimeZoneHelper.onCountryChangeCallback();
		}
	}
};
/*zen.api('PasswordAnalyzer',function(){

 window.PasswordAnalyzer={
 scoreWithReasons:function(pw,first_name,last_name,login){








 var useCharsets=[];
 var tips=$H({useMore:[],useSome:[]});


 var pwlength=(pw.length);
 if(pwlength>6)pwlength=6;


 var numnumeric=pw.replace(/[0-9]/g,"");
 var numeric=(pw.length-numnumeric.length);
 if(numeric>3){
 numeric=3;
}else if(numeric==0){
 useCharsets.push('numbers');


}


 var symbols=pw.replace(/\W/g,"");
 var numsymbols=(pw.length-symbols.length);
 if(numsymbols>3){
 numsymbols=3;
}else if(numsymbols==0){
 useCharsets.push("symbols (like #!&*%)");


}


 var numupper=pw.replace(/[A-Z]/g,"");
 var upper=(pw.length-numupper.length);
 if(upper>3){
 upper=3;
}else if(upper==0){
 useCharsets.push("uppercase letters")


}

 if('password'==pw){
 var pwstrength=10;
 var tips='must not be "password"';
}else if(pw.match(login)){
 var pwstrength=10;
 var tips='must not be your login';
}else if(pwlength<6){
 var pwstrength=0;
 var tips='6 characters minimum';
}else if(pw.length>40){
 var pwstrength=1;
 var tips='40 characters maximum';
}else if(pw.match(first_name)||pw.match(last_name)||pw.match(login)){
 var pwstrength=10;
 var tips='should not include first name, last name, or login';
}else{
 var pwstrength=((pwlength*10)-20)+(numeric*10)+(numsymbols*15)+(upper*10);
 var tips="Use "+useCharsets.join(', ');
}



 if(pwstrength>100)pwstrength=100;

 return[pwstrength,tips];
}
}
});*/

/*zen.require('xNative','xElement','PasswordAnalyzer','DomTemplate','Scroller','HTTP');
var SignupHelper={
 load:function(){
 zen.require('InputText','Button');
 InputText.enableAll();

 $('alternate_email','login','zenbe_password_confirmation').invoke('enableLazyChange');

 $('first_name').observe('blur',this.validateFirstName.bind(this));
 $('last_name').observe('blur',this.validateLastName.bind(this));
 $('login').observe('change',this.validateLogin.bind(this));
 $('zenbe_password').observe('blur',this.validatePassword.bind(this));
 $('zenbe_password_confirmation').observe('change',this.validatePassword.bind(this));
 $('alternate_email').observe('change',this.validateAlternateEmail.bind(this));
 $('terms_acceptance').observe('change',this.validateTOS.bind(this));




 $('first_name','last_name','alternate_email').invoke("setStyle",{visibility:'visible'});

 Button.create('submit_button',this.validateAndSubmit.bind(this));
 Button.create('open_terms_button',this.openTOS.bind(this));

 $('zenbe_password').observe('keyup',this.updatePasswordStrength.bind(this));

 $("sign_up_form").singleListener("click",this.handleHelpButtons.bindAsEventListener(this));

},

 handleHelpButtons:function(e){
 var helpButton=Event.element(e||event);

 if(helpButton.hasClassName('help_button')){
 var helpDialog=helpButton.next('.help_dialog');
 helpDialog.toggle()
 helpButton.toggleClassName('open');
}
},

 updatePasswordStrength:function(){
 var res=PasswordAnalyzer.scoreWithReasons($('zenbe_password').value,$('first_name').value,$('last_name').value,$('login').value);
 var score=res[0];
 var tips=res[1];

 var strength=null;var strengthClass=null;
 if(score==0){
 strength='too short';
 strengthClass="invalid";
}else if(score==1){
 strength='too long';
 strengthClass="invalid";
}else if(score<40){
 strength='weak';
 strengthClass=strength;
}else if(score<60){
 strength='fair';
 strengthClass=strength;
}else{
 strength='strong';
 strengthClass=strength;
 tips="";
}

 var template=new Template("<div class=\"password_strength #{strengthClass}\">#{strength}</div> <div id=\"password_tips\">#{tips}</div>");

 $('password_info').update(template.evaluate({strength:strength,strengthClass:strengthClass,score:score,tips:tips}));
},

 validateAndSubmit:function(){
 this.valid=true;
 console.debug("Validating...");

 $$('span.rounded').invoke('removeClassName','error');
 $$('div.error_message').invoke('hide');

 this.validateFirstName();
 this.validateLastName();
 this.validateLogin(null,true);
 this.validatePassword();
 this.validateAlternateEmail();
 this.validateTOS();

 if(this.valid){

 document.forms['sign_up_form'].submit();
 $('name_errors','email_errors').invoke("hide");
 return false
}else{
 console.debug("Not valid");
}
},

 validateFirstName:function(){
 if($('first_name').value.blank()){
 this.errorsOn('first_name',"Please enter a first name.");
}else{
 this.removeErrorsOn('first_name');
}
},

 validateLastName:function(){
 if($('last_name').value.blank()){
 this.errorsOn('last_name',"Please enter a last name.");
}else{
 this.removeErrorsOn('last_name');
}
},

 validateLogin:function(e,skipRemote){
 if($('login').value.blank()){

 this.errorsOn('login',"Please enter a login");
}else if($('login').value.length<3){
 this.errorsOn('login',"Must be 3 or more characters");
}else if($('login').value.length>40){
 this.errorsOn('login',"Must be 40 or fewer characters");
}else if(!$('login').value.match(/^[a-z]/ig)){
 this.errorsOn("login","Login must begin with a letter")
}else if(!$('login').value.match(/^[a-z][a-z0-9_\.]*$/ig)){
 this.errorsOn("login","Login must only contain a-z, 0-9, '.' and '_'")
}else if(skipRemote){
 console.debug("skipping remote");
 this.removeErrorsOn('login');
}else{
 this.remotelyValidateLogin();
}
},

 remotelyValidateLogin:function(){
 options={
 parameters:{login:$('login').value},
 onSuccess:function(transport){
(transport.responseJSON.size()==0)?this.removeErrorsOn('login'):this.errorsOn('login',"Login has already been taken");
}.bind(this)
};

 HTTP.post("/users/check_valid_username.json",null,options);
},

 validatePassword:function(){
 if($('zenbe_password').value.blank()){
 this.errorsOn('zenbe_password','Please enter a password');
}else if($('zenbe_password').value.length<6){
 this.errorsOn('zenbe_password',"Password must be at least 6 characters long");
}else if($('zenbe_password').value.length>40){
 this.errorsOn('zenbe_password',"Password must be at less than 40 characters long");
}else if($('zenbe_password').value!=$('zenbe_password_confirmation').value){
 this.errorsOn('zenbe_password_confirmation',"Passwords do not match");
}else{
 this.removeErrorsOn('zenbe_password');
 this.removeErrorsOn('zenbe_password_confirmation');
}
},

 validateAlternateEmail:function(){
 if($('alternate_email').value.blank()){
 this.errorsOn('alternate_email',"Please enter an alternate email.");
}else if(!$('alternate_email').value.isEmailAddress()){
 this.errorsOn('alternate_email','Please enter a valid alternate email address.');
}else if($('alternate_email').value.match(/zenbe.com$/)){
 this.errorsOn('alternate_email',"Please enter a non-Zenbe alternate email address.");
}else{
 this.removeErrorsOn('alternate_email');
}
},

 validateTOS:function(){
 if(!$('terms_acceptance').checked){
 this.errorsOn('terms_acceptance',"Do you accept the Terms and Conditions of use?");
}else{
 this.removeErrorsOn('terms_acceptance');
}
},

 errorsOn:function(name,msg){
 this.valid=false;
 this.updateErrors(true,name,msg);
},
 removeErrorsOn:function(name){
 this.updateErrors(false,name);
},

 updateErrors:function(add,name,msg){
 $(name).up('span')[add?"addClassName":"removeClassName"]('error');
 if('zenbe_password'==name){

}else if('zenbe_password_confirmation'==name){
 $('password_confirmation_info').down('.default_message').hide();
 $('password_confirmation_info').down('div.success_message')[add?'hide':'show']();
 $('password_confirmation_info').down('div.error_message').update(msg)[add?'show':'hide']();
}else if('login'==name){
 $('login_info').down('div.default_message').hide();
 $('login_info').down('div.success_message')[add?'hide':'show']();
 $('login_info').down('div.error_message').update(msg)[add?'show':'hide']();
}else{
 $(name).up('span').next('div.error_message').update(msg)[add?'show':'hide']();
}
},

 openTOS:function(){
 console.debug("opening TOS");
 var tmpl=DomTemplate.getTemplate('tos_template',true);


 this.TOSModal=new Control.Modal(false,{
 opacity:0.5,
 width:480,
 height:500,
 overlayCloseOnClick:true,
 contents:tmpl.evaluate({}),
 afterOpen:function(){

 $('tos_outer_dialog').show()

 window.TOSscroller=new Scroller('tos_scroller');
 Button.create('tos_accept_button',function(){
 $('terms_acceptance').checked=true
 SignupHelper.TOSModal.close();
});
 Button.create('tos_cancel_button',function(){
 SignupHelper.TOSModal.close();
})

}
});
 this.TOSModal.open();
}
}

if(!Prototype.Browser.MobileSafari)Event.observe(window,'load',SignupHelper.load.bind(SignupHelper));*/