	var xmlHttp
	
	function GetXmlHttpObject(handler)
	{ 
		var objXmlHttp=null
		 
		if (navigator.userAgent.indexOf("Opera")>=0)
		{
			alert("This example doesn't work in Opera") 
			return 
		}
		if (navigator.userAgent.indexOf("MSIE")>=0)
		{ 
			var strName = "Msxml2.XMLHTTP"
			if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
			{
				strName="Microsoft.XMLHTTP"
			} 
			try
			{ 
				objXmlHttp=new ActiveXObject(strName)
				objXmlHttp.onreadystatechange=handler 
				return objXmlHttp
			} 
			catch(e)
			{ 
				alert("Error. Scripting for ActiveX might be disabled") 
				return 
			} 
		} 
		if (navigator.userAgent.indexOf("Mozilla")>=0)
		{    
			document.getElementById("password_forgot_results").innerHTML = '<table><tr><td><img src="indicator.gif" width="16" height="16"></td><td>Loading...</td></tr></table>' 
			objXmlHttp = new XMLHttpRequest()
			objXmlHttp.onload  = handler
			objXmlHttp.onerror = handler 
			return objXmlHttp
		}  
		
	}  /*-- FUNCTION GetForgotXmlHttpObject() ENDS HERE --*/
  
	function forgot_user_name() {	 
		 var email = document.forgot_password_frm.email.value;
		 if(IsEmail('forgot_password_frm','email'))
		 {
		 	alert("Invalid Email");
		 	document.forgot_password_frm.email.focus();
		 	return false;
		 }
		 
		 if(email!='') {	 
			 document.getElementById("password_forgot_btn").style.display = "none";
			 document.getElementById("have_no_result").style.display = "none";
			 var url = "find_password.php?email="+email+"&act=user";
			 xmlHttp = GetXmlHttpObject(forgotPasswordResult)
			 xmlHttp.open("GET",url, true)
			 xmlHttp.send(null)
		 }
		 
	 } /*-- FUNCTION forgot_user_name() ENDS HERE --*/
  
	function forgot_email() {	 
		 var user_name = document.forgot_password_frm.user_name.value;
		 var email = document.forgot_password_frm.email.value;
		 var rand_word = document.forgot_password_frm.rand_word.value;
		 if(user_name == '')
		 {
		 	alert("Username is Empty");
		 	document.forgot_password_frm.user_name.focus();
		 	return false;
		 }
		 if(IsEmail('forgot_password_frm','email'))
		 {
		 	alert("Invalid Email");
		 	document.forgot_password_frm.email.focus();
		 	return false;
		 } 
		 if(email != '' && user_name != '') {
			   document.getElementById("password_forgot_btn").style.display = "none";			   
			   var url = "find_password.php?uname="+user_name+"&email="+email+"&rand_word="+rand_word+"&act=pass";
			   xmlHttp = GetXmlHttpObject(forgotPasswordResult)
			   xmlHttp.open("GET",url, true)
			   xmlHttp.send(null)
		 }
		 
	 } /*-- FUNCTION forgot_email() ENDS HERE --*/
	
	function forgotPasswordResult() 
	{  
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  
		{ 
			document.getElementById("password_forgot_results").style.display = "block";
			document.getElementById("password_forgot_results").innerHTML = xmlHttp.responseText;			  
		}
		else 
		{
			document.getElementById("password_forgot_results").innerHTML = '<table><tr><td><img src="indicator.gif" width="16" height="16"></td><td>Loading...</td></tr></table>';
		} 
		
	}  /*-- FUNCTION checkEmailExistResult() ENDS HERE --*/ 
    function ClearUserFields()
    {
    	document.forgot_password_frm.email.value = "";
    	document.forgot_password_frm.answer.value = "";
    	return false;
    }
    function ClearPassFields()
    {
    	document.forgot_password_frm.user_name.value = "";
    	document.forgot_password_frm.email.value = "";
    	document.forgot_password_frm.answer.value = "";
    	return false;
    }
    
    
    function CheckPassFields()
    {
    	if(IsBlank('forgot_password_frm','user_name'))
    	{
    		alert("Username Field is Empty");
    		document.forgot_password_frm.user_name.focus();
	 		return false;
    	}
    	if(IsBlank('forgot_password_frm','email'))
    	{
    		alert("Email Field is Empty");
    		document.forgot_password_frm.email.focus();
	 		return false;
    	}
    	if(IsEmail('forgot_password_frm','email'))
    	{
    		alert("Email Field is Invalid");
	 		document.forgot_password_frm.email.focus();
	 		return false;
    	}
    	if(IsBlank('forgot_password_frm','answer'))
    	{
    		alert("Answer Field is Empty");
	 		document.forgot_password_frm.answer.focus();
	 		return false;
    	}
    	email = document.forgot_password_frm.email.value;
    	uname = document.forgot_password_frm.user_name.value;
    	answer = document.forgot_password_frm.answer.value;
		   var url = "find_password.php?uname="+uname+"&email="+email+"&answer="+answer+"&act=passres";
		   xmlHttp = GetXmlHttpObject(passwordChangeResult)
		   xmlHttp.open("GET",url, true)
		   xmlHttp.send(null)
    }
    
    function CheckUserFields()
    {
    	if(IsBlank('forgot_password_frm','email'))
    	{
    		alert("Email Field is Empty");
    		document.forgot_password_frm.email.focus();
	 		return false;
    	}
    	if(IsEmail('forgot_password_frm','email'))
    	{
    		alert("Email Field is Invalid");
	 		document.forgot_password_frm.email.focus();
	 		return false;
    	}
    	if(IsBlank('forgot_password_frm','answer'))
    	{
    		alert("Answer Field is Empty");
	 		document.forgot_password_frm.answer.focus();
	 		return false;
    	}
    	email = document.forgot_password_frm.email.value;
    	answer = document.forgot_password_frm.answer.value;
		   var url = "find_password.php?email="+email+"&answer="+answer+"&act=userres";
		   xmlHttp = GetXmlHttpObject(passwordChangeResult)
		   xmlHttp.open("GET",url, true)
		   xmlHttp.send(null)    	
    }
    function passwordChangeResult() 
	{  
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  
		{ 
			document.getElementById("password_change_result").style.display = "block";
			document.getElementById("password_forgot_results").innerHTML = "";
			document.getElementById("password_forgot_results").style.display = "none";
			document.getElementById("password_change_result").innerHTML = xmlHttp.responseText;			  
		}
		else 
		{
			document.getElementById("password_change_result").innerHTML = '';
		} 		
	}  /*-- FUNCTION checkEmailExistResult() ENDS HERE --*/ 
    function ForgotCheckEnter(e)
	 {
	 	 var characterCode 		
		 if(e && e.which){ //if which property of event object is supported (NN4)
			e = e
			characterCode = e.which //character code is contained in NN4's which property
		 }
		  else{
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		 }		
		 if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			forgot_user_name();
			return false;
		 }
		 else{
			return true 
		 }	
	 }
	 function NoQuestionCheckEnter(e)
	 {
	 	 var characterCode 		
		 if(e && e.which){ //if which property of event object is supported (NN4)
			e = e
			characterCode = e.which //character code is contained in NN4's which property
		 }
		  else{
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		 }		
		 if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			noQuestionUser();
			return false;			
		 }
		 else{
			return true 
		 }	
	 }
	 function noQuestionUser()
	 {
	 	if(IsBlank('forgot_password_frm','email'))
    	{
    		alert("Email Field is Empty");
	 		document.forgot_password_frm.email.focus();
	 		return false;
    	}
	 	
	 	if(IsEmail('forgot_password_frm','email'))
    	{
    		alert("Email Field is Invalid");
	 		document.forgot_password_frm.email.select();
	 		return false;
    	}
	 	if(IsBlank('forgot_password_frm','no_question_fname'))
    	{
    		alert("First Name Field is Empty");
	 		document.forgot_password_frm.no_question_fname.focus();
	 		return false;
    	}
    	if(IsBlank('forgot_password_frm','no_question_lname'))
    	{
    		alert("Last Name Field is Empty");
	 		document.forgot_password_frm.no_question_lname.focus();
	 		return false;
    	}
    	if(IsBlank('forgot_password_frm','captcha')) {
			 alert("Verification Code Field is Empty"); 
			 return false;
		}
		  return check('username');
		if(document.forgot_password_frm.temp.value != 'Valid') {
		      alert("Verification Code  is Invalid");
		      document.forgot_password_frm.captcha.select();
			  return false;
		}
    	document.forgot_password_frm.method="post";
    	document.forgot_password_frm.action="forgot_username.php?act=noQ";
    	document.forgot_password_frm.submit();
	 }
	 function NoQuestionCheckEnter1(e)
	 {
	 	 var characterCode 		
		 if(e && e.which){ //if which property of event object is supported (NN4)
			e = e
			characterCode = e.which //character code is contained in NN4's which property
		 }
		  else{
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		 }		
		 if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			noQuestionPass();
			return false;	    	
		 }
		 else{
			return true 
		 }	
	 }
	 function noQuestionPass()
	 {
	 	if(IsBlank('forgot_password_frm','email'))
    	{
    		alert("Email Field is Empty");
	 		document.forgot_password_frm.email.focus();
	 		return false;
    	}
	 	
	 	if(IsEmail('forgot_password_frm','email'))
    	{
    		alert("Email Field is Invalid");
	 		document.forgot_password_frm.email.select();
	 		return false;
    	}
    	
	 	if(IsBlank('forgot_password_frm','no_question_fname'))
    	{
    		alert("First Name Field is Empty");
	 		document.forgot_password_frm.no_question_fname.focus();
	 		return false;
    	}
    	if(IsBlank('forgot_password_frm','no_question_lname'))
    	{
    		alert("Last Name Field is Empty");
	 		document.forgot_password_frm.no_question_lname.focus();
	 		return false;
    	}
    	if(IsBlank('forgot_password_frm','captcha')) {
			 alert("Verification Code Field is Empty"); 
			 return false;
		}
		
		return check('password');
		  
		if(document.forgot_password_frm.temp.value != 'Valid') {
		      alert("Verification Code  is Invalid");
		      document.forgot_password_frm.captcha.select();
			  return false;
		}
    	document.forgot_password_frm.method="post";
    	document.forgot_password_frm.action="forgot_password.php?act=noQ";
    	document.forgot_password_frm.submit();
	 }
	 function ForgotCheckEnter1(e)
	 {
	 	 var characterCode 		
		 if(e && e.which){ //if which property of event object is supported (NN4)
			e = e
			characterCode = e.which //character code is contained in NN4's which property
		 }
		  else{
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		 }		
		 if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
			forgot_email();
			return false;
		 }
		 else{
			return true 
		 }	
	 }
	 function enterUserAnswer(e)
	 {
	 	 var characterCode 		
		 if(e && e.which) {
			e = e
			characterCode = e.which 
		 }
		  else { 
			e = event
			characterCode = e.keyCode
		 }		
		 if(characterCode == 13) {
			CheckUserFields();
			return false;
		 }
		 else {
			return true 
		 }		 	 
	 }
	 function enterPassAnswer(e)
	 {
	 	 var characterCode 		
		 if(e && e.which) {
			e = e
			characterCode = e.which 
		 }
		  else { 
			e = event
			characterCode = e.keyCode
		 }		
		 if(characterCode == 13) {
			CheckPassFields();
			return false;
		 }
		 else {
			return true 
		 }		 	 
	 }