


var Profile = Class.create();

Profile.prototype = {
	initialize: function() {
		
	},
	
	passwordReset: function(e) {
		if(e)
			Event.stop(e);
		if(!$('email').present())
			new Effect.Shake('email');
		else
		{
			showLoading('status', true);
			new Ajax.Request(ajaxUrl, {postBody:'ajaxAction=passwordReset&' + $('passwordForm').serialize(), onComplete: this._passwordReset_callback.bindAsEventListener(this)});
		}
	},
	
	_passwordReset_callback: function(request) {
		if(request.responseText == 'true')
			$('status').update('Your password was reset successfully. An email was sent to the address you provided with the new one.');
		else if(request.responseText == 'no-email')
			$('status').update("The email you provided isn't registered in our database.");
		else if(request.responseText == 'false')
			$('status').update('There was an undefined error while we tried to process your request. Sorry for the inconvenience. If the problem persists, please contact our support team.');
	}
};

var profile = new Profile();
