var strMsg = '';
var intIndex = 1;
function fnLogin()
{
	
	{
			
		if (!fnValidate())
		{
			alert(strMsg);
			strMsg = '';
			intIndex = 1;
		}
		else
		{
			document.frm.action = "Login.asp?Mode=Login";
			document.frm.method="POST";
			document.frm.submit();
		}
	}	
}

function fnValidate()
{
//	return true;
//	alert('1');
	var txtLogin = document.getElementById('txtLogin').value;
	var txtPassword	= document.getElementById('txtPassword').value;
	LoginStatus = ""
	PasswordStatus = ""
	
	if (isEmpty_(txtLogin))
	{
		strMsg += intIndex + '. Email Id cannot be empty.\n';
		LoginStatus = "Login";
		intIndex += 1;
	}
	else if (!checkemail_(txtLogin))
	{
		strMsg += intIndex + '. Invalid Email Id.\n';
		LoginStatus = "Login";
		intIndex += 1;
	}
	
	if ((isEmpty_(txtPassword)) || (txtPassword == "Password"))
	{
		strMsg += intIndex + '. Password cannot be empty or equal to `Password`.\n';
		PasswordStatus = "Password";
		intIndex += 1;
	}
	
	if (strMsg.length > 0 )
	{
		if (LoginStatus == "Login")
			document.getElementById('txtLogin').focus();
		if (PasswordStatus == "Password")
			document.getElementById('txtPassword').focus();
		if ((LoginStatus == "Login") && (PasswordStatus == "Password"))
			document.getElementById('txtLogin').focus();
			
		return false;
	}
		
	return true;
}

function load_first() 
{
	status = document.getElementById('hdnstatus_').value 		
	if (status == "fail"){
		alert ("No Record(s) found !");
	}
	status = document.getElementById('hdnloginfailed_').value
	if (status == "true"){
		alert ("Login Authentication failed, Try again !");
	} 
	if (status=="inActive"){

		alert ("You are Deactivated, please contact System Administrator !");
		document.frm.action="contactus.asp"
		document.frm.method="POST"
		document.frm.submit();
	} 

	pwdChangeStatus = document.getElementById('hdnchgpwd_').value
	if (pwdChangeStatus=="Success"){
		alert ("Your password has been changed successfully !");
	}
	
}
