YAHOO.namespace("Youniverse");

YAHOO.Youniverse.forgotLogin = function()
{
	/*
	* Initialise class when window dom loaded
	*/
	this.initClass = function ()
	{
	}
	
	/*
	* Load ForgotLogin	
	*/
	this.loadForgotLogin = function ()
	{
		var callback =
		{
		  success:this.onLoadForgotLogin,
		  failure:this.ajaxFailure,
		  cache: false 
		};
		
		var request = YAHOO.util.Connect.asyncRequest('GET', "/dialog/forgot_login/", callback);
	}
	/*
	* onLoad Register	
	*/
	this.onLoadForgotLogin = function(o)
	{
		response = o.responseText;
		
		dialogBox.setBody(response);
		dialogBox.setHeight();
		dialogBox.openDialog();
		
		setTimeout("forgotLogin.setFocus()", 1000);
	}
	/*
	* Ajax Failure	
	*/
	this.ajaxFailure = function ()
	{
		alert(msg.translate('err01'));
	}
	
	/*
	* Submit Forgot Login
	* @ formID is the ID of the form
	*/
	this.submitForgotLogin = function (formID)
	{
		var formObject = document.getElementById(formID+"Form"); 
		
		YAHOO.util.Connect.setForm(formObject);
		
		var callback = 
		{ 
			success: this.onSubmitForgotLogin, 
			failure: this.ajaxFailure
		};
		var cObj = YAHOO.util.Connect.asyncRequest('POST', "/user/forgot_login", callback);
	}
	
	/*
	* onSubmit Login
	* @ o is the response object
	*/
	this.onSubmitForgotLogin = function (o)
	{
		eval(o.responseText);
	}
	
	/* 
	* Set focus of the first form item
	*/
	this.setFocus =function ()
	{
		document.getElementById("UserEmail").focus();
	}

}