/*
-- This is to validate the form for User Login--
-- Developed By : Binita --
-- Copyright Continuum Systems.com --
-- Cretion Date : 16-05-2005 --
-- Last Updated : 16-05-2005 --
-- MeerMoneyTransfer Version : 1.0 --
*/

function frmValidUser(frmLogin)
{
	var BlnFocus	;	// Carry the field name where we have to take the focus, it will be the first field where error occurs
	BlnFocus=false;
	var ValStatus;		//Flag to check the true/false validation status
	ValStatus=1;		// Set Flag 1 if validation is true;
	
	// ----------------- User Name Validation--------------------------
	if(frmLogin.txtUserName.value=="")
	{
		BlnFocus=true;
		frmLogin.txtUserName.focus();
		DisplayMessage("spnUserName","Please Enter Username")//Call function to Display Error Message
		ValStatus=0;
	}
	else
	{
		DisplayMessage("spnUserName","")//Clear Message from control
	}
	//-------------------End of User Name Validation-------------------
	
	// ----------------- Password Validation--------------------------
	if(frmLogin.txtPassword.value=="")
	{
		BlnFocus=true;
		frmLogin.txtPassword.focus();
		DisplayMessage("spnPassword","Please Enter Password")//Call function to Display Error Message
		ValStatus=0;
	}
	else
	{
		DisplayMessage("spnPassword","")//Clear Message from control
	}
	//-------------------End of User Name Validation-------------------
	
	// ----------------- Validation Status  -----------------------------
	if (ValStatus==0)
	{
		return false; // Validation FAILED
	}
	else
	{
		return true; // Validation SUCCESSFULL
	}
	// ----------------- Closing Validation function  ----------------------

}

function fnUserConfirmation(frmForgotPassword)
{
	var BlnFocus	;	// Carry the field name where we have to take the focus, it will be the first field where error occurs
	BlnFocus=false;
	var ValStatus;		//Flag to check the true/false validation status
	ValStatus=1;		// Set Flag 1 if validation is true;
	
	// ----------------- User Name Validation--------------------------
	if(frmForgotPassword.txtUserName.value=="")
	{
		BlnFocus=true;
		frmForgotPassword.txtUserName.focus();
		DisplayMessage("spnUserName","Please Enter Username")//Call function to Display Error Message
		ValStatus=0;
	}
	else
	{
		DisplayMessage("spnUserName","")//Clear Message from control
	}
	//-------------------End of User Name Validation-------------------
	
	// ----------------- Validation Status  -----------------------------
	if (ValStatus==0)
	{
		return false; // Validation FAILED
	}
	else
	{
		return true; // Validation SUCCESSFULL
	}
	// ----------------- Closing Validation function  ----------------------
}


//----------------Error Display Function--------------------
function DisplayMessage(ctlName,errMsg) // Param 1 is Name of the control and Param 2 is error message
{
	var strErrorContent;// Use to display error msg in format
	strErrorContent="<table border=0 cellspacing=0 cellpadding=0>";
	strErrorContent+="<tr><td width=18><img src=images/alertArrow1.gif /></td>";
	strErrorContent+="<td class=validationAlert>"+errMsg+"</td>";
	strErrorContent+="</tr></table>";
	if(errMsg!="")
	{
		document.getElementById(ctlName).innerHTML=strErrorContent; // Displaying Error
	}
	else
	{
		document.getElementById(ctlName).innerHTML=""; // Clearing display if no error
	}
}
//----------------Closing Error Display Function--------------------
