if (!PB) var PB = {};

var registrationForm = Class.create(PB.Form,{
	initialize:function($super,element,options)
	{
		$super(element,options || {});
		this.onchanges['info[is_biz]']= function(){$('info[is_biz]').checked ? $('biz_registration_info').removeClassName('hidden') : $('biz_registration_info').addClassName('hidden');};
	},
	preSubmit:function()
	{
		if($('users[accepts_eula]').checked)
			return true;
		
		else
			window.growler.error('You must accept the eula.',{header:'Error.'});
		//	this.notifyError({field:'info[accepts_eula]', message:'You must accept the eula', higlight_field:true});
		
		return false;
	},
	onSuccess:function(response)
	{
		foo = eval(response);
		if(foo.location)
			document.location = foo.location;
	}
});

function initRegistrationForm()
{
	if($('registration_form'))
		PB.Forms.registration_form = new registrationForm('registration_form');
	
	if($('forgot_pass_form'))
		PB.Forms.forgot_pass_form = new PB.Form('forgot_pass_form');
}
PB.addToDomLoad('initRegistrationForm');

