var login={};
login.showLoginForm=function(){
	x=getElementId("loginForm");
	xf=getElementId("user_name");
	if(x.style.display=="none"){x.style.display="block";
	xf.focus();}else if(x.style.display=="block"){x.style.display="none";}
}
login.forgot=function(){
	login.hideLoginForm();
	
	x=getElementId("forgotPass");
	xp=getElementId("forgot");
	if(x.style.display=="none"){
		x.style.display="block";
	}else if(x.style.display=="block"){
		x.style.display="none";
	}
	xp.email_address.focus();
}
login.forgotPass=function(){
	URL=APPLICATION_URL+"home/forgotPass?ajaxcall=true";
	x=getElementId("forgot");
	handleSuccess=function(o){
		getElementId("msg").innerHTML=o.responseText;
	}
x.email_address.focus();
callback={success:handleSuccess,failure:this.handleFailure}
YAHOO.util.Connect.setForm(x);
YAHOO.util.Connect.asyncRequest("POST",URL,callback);}

login.hideLoginForm=function(){x=getElementId("loginForm");x.style.display="none"}

login.showForgotForm=function(){x=getElementId("forgot");x.style.display="block"}

login.password_form=function(){
	editAccountPanel.show();
	var heading=getElementId("heading");
	heading.innerHTML='Change Password';
	var URL=APPLICATION_URL+"myaccount/password_form/?ajaxcall=true";
	handleSuccess=function(o){
		getElementId("editaccountDiv").innerHTML=o.responseText;
	}
callback={success:handleSuccess,failure:this.handleFailure}
YAHOO.util.Connect.asyncRequest("GET",URL,callback);}

login.change_password=function(){
	var URL=APPLICATION_URL+"myaccount/change_password?ajaxcall=true";
	var formObject=getElementId("editaccount");
	handleSuccess=function(o){
		if(parseInt(o.responseText)==1){
			alert("Password changed successfully");
			editAccountPanel.hide();
			//location.href=APPLICATION_URL+'warranty/viewnotes/'+warrantyId;
		}else{
			getElementId("editaccountDiv").innerHTML=o.responseText;
		}
	}
callback={success:handleSuccess,failure:this.handleFailure}
YAHOO.util.Connect.setForm(formObject);YAHOO.util.Connect.asyncRequest("POST",URL,callback);}


