
	var request = null;
	var txtEmail = document.getElementById("txtEmail")
	var txtPassword = document.getElementById("txtPassword")
	try{		
			request = new XMLHttpRequest();			
			}catch (trymicrosoft) {			
			try{			
				request = new ActiveXObject("Msxml2.XMLHTTP");			
			}catch (othermicrosoft) {			
				try{					
					request = new ActiveXObject("Microsoft.XMLHTTP");					
				}catch (failed) {				
					request = null;					
				}
			}
		} 
		
		if (request == null){
			alert("Error: AJAX interaction failed.");
		}
		
		var inOrnotInDb = "default";
		
	function logUserIn() {
		var emailAddress = document.getElementById("emailAddress")
		var url = "/c/account/ForgotAjax.aspx?emailAddress="+emailAddress.value;
		
		request.open("GET", url, false);
		request.onreadystatechange = test2;				 		
		request.send(null);

		//var inOrnotInDb = request.responseText;
		//inOrnotInDb = request.responseText;
		
		//alert("inside logUserIn = "+inOrnotInDb);
		return inOrnotInDb;
	}
	
	function test2() {
		if (request.readyState == 4) {
			//alert("inside test2= " +request.responseText);
			inOrnotInDb = request.responseText;
			//alert("inside test = "+inOrnotInDb);
		}
		else {
		//alert("else");
		}
	}

	//validate the email address for forgotpassword functionality 
	function echeck(str) {

			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			if (str.indexOf(at)==-1){
			//alert("Invalid E-mail ID")
			return false
			}

			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			//alert("Invalid E-mail ID")
			return false
			}

			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
				//alert("Invalid E-mail ID")
				return false
			}

			if (str.indexOf(at,(lat+1))!=-1){
				//alert("Invalid E-mail ID")
				return false
			}

			if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
				//alert("Invalid E-mail ID")
				return false
			}

			if (str.indexOf(dot,(lat+2))==-1){
				//alert("Invalid E-mail ID")
				return false
			}
			
			if (str.indexOf(" ")!=-1){
				//alert("Invalid E-mail ID")
				return false
			}

 			return true					
		}
	//validate the email address for forgotpassword functionality
	function ValidateForm(){
		var emailAddress=document.getElementById("emailAddress")
		var errorEmptyForgot=document.getElementById("errorEmptyForgot")
		var errorInvalidForgot=document.getElementById("errorInvalidForgot")
		
		if ((emailAddress.value==null)||(emailAddress.value=="")){
			//alert("Please Enter your Email ID")
			errorEmptyForgot.style.display = "block";
			errorInvalidForgot.style.display = "none";
			emailAddress.focus()
			return false
		}
		if (echeck(emailAddress.value)==false){
			emailAddress.value=""
			errorInvalidForgot.style.display = "block";
			errorEmptyForgot.style.display = "none";
			emailAddress.focus()
			return false
		}
		
		errorInvalidForgot.style.display = "none";
		errorEmptyForgot.style.display = "none";
		return true
	}

	function showForgot()
	{
		document.getElementById("divForgotContainer").style.display = "block";
		document.getElementById("divResponse").style.display = "none";
		document.getElementById("divResponse2").style.display = "none";
	}
	function showResponse()
	{
		if (ValidateForm() == true) { 
			//make a call to the vb to check the crestor db for the user, and send the email
			if (logUserIn() == "Y") {
				
				//alert("inside showResponse IF = "+inOrnotInDb);
				//user is found in db
				document.getElementById("divResponse").style.display = "block";
				document.getElementById("divResponse2").style.display = "none";
				document.getElementById("divForgotContainer").style.display = "none";
			}
			else {
				//alert("inside showResponse ELSE = "+inOrnotInDb);
				//user is not found in db
				document.getElementById("divResponse2").style.display = "block";
				document.getElementById("divResponse").style.display = "none";
				document.getElementById("divForgotContainer").style.display = "none";
			}
		}
	}
	function hideResponse()
	{
		document.getElementById("divResponse").style.display = "none";
		document.getElementById("divResponse2").style.display = "none";
		document.getElementById("divForgotContainer").style.display = "none";
	}
	function showLogin()
	{
		document.getElementById("sb_login").style.display="none";
		document.getElementById("divResponse").style.display = "none";
		document.getElementById("divResponse2").style.display = "none";
		document.getElementById("divForgotContainer").style.display = "none";
		document.getElementById("sb_login_input").style.display = "block";
	}
	function showWelcome()
	{
		document.getElementById("divResponse").style.display = "none";
		document.getElementById("divResponse2").style.display = "none";
		document.getElementById("divForgotContainer").style.display = "none";
		document.getElementById("sb_login_input").style.display = "none";
		//document.getElementById("divLoggedIn").style.display = "block";
		document.getElementById("divInput").style.display = "none";
		
	}