// JavaScript Document
function LoginValidation()
{
	if (document.clientLogin.UserName.value=="")
	{
	alert("Email Address is required.")
	document.clientLogin.UserName.focus();
	return false;
	}
	if (document.clientLogin.Pwd.value=="")
	{
	alert("Password is required.")
	document.clientLogin.Pwd.focus();
	return false;
	}
	return true;
}

function AddAccValidation()
{
	if(document.AccFrm.AccountNumber.value=="")
	{
		alert("Enter Account Number.")
		document.AccFrm.AccountNumber.focus();
		return false;
	}
	if(document.AccFrm.Comments.value=="")
	{
		alert("Enter Comments.")
		document.AccFrm.Comments.focus();
		return false;
	}
return true;
}

function AddExeValidation()
{

	if (document.frmExe.FirstName.value=="")
	{
		alert("First Name is required");
		document.frmExe.FirstName.focus();
		return false;
	}
	if (document.frmExe.LastName.value=="")
	{
		alert("Last Name is required");
		document.frmExe.LastName.focus();
		return false;
	}
	if (document.frmExe.ListAccounts.value=="")
	{
		alert("Select atleast one Account.");
		document.frmExe.ListAccounts.focus();
		return false;
	}

	
	if (document.frmExe.CPH1.value=="")
	{
		alert("Contact Phone Number is required.");
		document.frmExe.CPH1.focus();
		return false;
	}
	else
	{
		if (isNaN(document.frmExe.CPH1.value))
		{
			alert("Contact Phone Number is Invalid.");
			document.frmExe.CPH1.focus();
			return false;
		}
	}
	
	if (document.frmExe.CPH2.value=="")
	{
		alert("Contact Phone Number is required.");
		document.frmExe.CPH2.focus();
		return false;
	}
	else
	{
		if (isNaN(document.frmExe.CPH2.value))
		{
			alert("Contact Phone Number is Invalid.");
			document.frmExe.CPH2.focus();
			return false;
		}
	}
	
	if (document.frmExe.CPH3.value=="")
	{
		alert("Contact Phone Number is required.");
		document.frmExe.CPH3.focus();
		return false;
	}
	else
	{
		if (isNaN(document.frmExe.CPH3.value))
		{
			alert("Contact Phone Number is required.");
			document.frmExe.CPH3.focus();
			return false;
		}
	
	}
	
	////////////#############Email Validation#################//////////////
	if (document.frmExe.Email.value=="")
	{
		alert("Email should not be blank.")
		document.frmExe.Email.focus();
		return false;
	}

	var str = document.frmExe.Email.value;   
	if (str.length<=5)
	{
		alert("Email should not be less than 6 characters.")
		document.frmExe.Email.focus();
		return false;
	}
	
	var mail = document.frmExe.Email.value;
	if (mail == "")
	{
		alert("Incomplete E-mail Address");
		document.frmExe.Email.focus();
		return false;
	}
	if (mail.indexOf("@")== -1)
	{
		alert("Invalid E-mail")
		document.frmExe.Email.select();
		document.frmExe.Email.focus();
		return false;
	}
	if (mail.indexOf(".")== -1)
	{
		alert("Invalid E-mail")
		document.frmExe.Email.select();
		document.frmExe.Email.focus();
		return false;
	}
	var aa=0;
	var bb=0;
	var cc=0;
	var td="";
	for (j =0 ; j<mail.length ;j++)
	{
		if(mail.charAt(j) =="@"){
		aa=j;
		cc=cc+1;
			if ((aa==0) || (cc>1)){
				alert("Invalid E-mail Format");
				document.frmExe.Email.select();
				document.frmExe.Email.focus();
				return false;
			}
		}else if(mail.charAt(j)=="."){
		bb=j;
		td=td+mail.charAt(j);
			if(td==".."){
				alert("Invalid E-mail Format");
				document.frmExe.Email.select();
				document.frmExe.Email.focus();
				return false;
			}
			if (bb==0){
				alert("Invalid E-mail Format");
				document.frmExe.Email.select();
				document.frmExe.Email.focus();
				return false;
			}
		}else{
			td="";
		}
	} //end for loop
	if (aa == mail.length-1)
	{
	    alert("Invalid E-mail Format");
		document.frmExe.Email.select();
		document.frmExe.Email.focus();
		return false;
	}
	if (bb == mail.length-1)
	{
		alert("Invalid E-mail Format");
		document.frmExe.Email.select();
		document.frmExe.Email.focus();
		return false;
	}
	if(aa >= (bb-1))
	{
		alert("Invalid E-mail Format");
		document.frmExe.Email.select();
		document.frmExe.Email.focus();
		return false;
	}
	////////###########################################//////////////////////////////
	

	
	/*if (document.frmExe.UserName.value=="")
	{
		alert("User Name is required.");
		document.frmExe.UserName.focus();
		return false;
	}*/
	if (document.frmExe.Pwd.value=="")
	{
		alert("Password is required.");
		document.frmExe.Pwd.focus();
		return false;
	}
	var strpwd;
	strpwd=document.frmExe.Pwd.value;
	if(strpwd.length<=5)
	{
	alert("Password Can not be less than six characters.")
	document.frmExe.Pwd.focus();
	return false;
	}
	
	//For One Alpha And One Numeric	
		 var re1char=/[A-Za-z]/  //regular expression 
		 var re1digit=/[0-9]/
			if ((document.frmExe.Pwd.value.search(re1char)==-1) || (document.frmExe.Pwd.value.search(re1digit)==-1) ) //if match failed
			{
			alert("Password has to be alphanumeric.")
			document.frmExe.Pwd.focus();
			return false;
			
			}
	//For One Alpha And One Numeric
	
	if (document.frmExe.ConfirmPwd.value=="")
	{
		alert("Retype Password.");
		document.frmExe.ConfirmPwd.focus();
		return false;
	}
	if(document.frmExe.Pwd.value!=document.frmExe.ConfirmPwd.value)
	{
	alert("Password Doesn't Match")
	document.frmExe.ConfirmPwd.focus();
	return false;
	}
	
	if (document.frmExe.SecretQuestion.value=="")
	{
		alert("Select any Question.");
		document.frmExe.SecretQuestion.focus();
		return false;
	}
	if (document.frmExe.SecretAnswer.value=="")
	{
		alert("Answer is required.");
		document.frmExe.SecretAnswer.focus();
		return false;
	}
	
return true;
}




function validatereg()
{


if(document.Regfrm.FirstName.value=="")
{
alert("First Name is required.")
document.Regfrm.FirstName.focus();
return false;
}
if(document.Regfrm.LastName.value=="")
{
alert("Last Name is required.")
document.Regfrm.LastName.focus();
return false;
}
if(document.Regfrm.AccountNumber.value=="")
{
alert("Account Number is required.")
document.Regfrm.AccountNumber.focus();
return false;
}
////////////#############3Email Validation#################//////////////
	if (document.Regfrm.Email.value=="")
	{
		alert("Email should not be blank.")
		document.Regfrm.Email.focus();
		return false;
	}

	var str = document.Regfrm.Email.value;   
	if (str.length<=5)
	{
		alert("Email should not be less than 6 characters.")
		document.Regfrm.Email.focus();
		return false;
	}
	
	var mail = document.Regfrm.Email.value;
	if (mail == "")
	{
		alert("Incomplete E-mail Address");
		document.Regfrm.Email.focus();
		return false;
	}
	if (mail.indexOf("@")== -1)
	{
		alert("Invalid E-mail")
		document.Regfrm.Email.select();
		document.Regfrm.Email.focus();
		return false;
	}
	if (mail.indexOf(".")== -1)
	{
		alert("Invalid E-mail")
		document.Regfrm.Email.select();
		document.Regfrm.Email.focus();
		return false;
	}
	var aa=0;
	var bb=0;
	var cc=0;
	var td="";
	for (j =0 ; j<mail.length ;j++)
	{
		if(mail.charAt(j) =="@"){
		aa=j;
		cc=cc+1;
			if ((aa==0) || (cc>1)){
				alert("Invalid E-mail Format");
				document.Regfrm.Email.select();
				document.Regfrm.Email.focus();
				return false;
			}
		}else if(mail.charAt(j)=="."){
		bb=j;
		td=td+mail.charAt(j);
			if(td==".."){
				alert("Invalid E-mail Format");
				document.Regfrm.Email.select();
				document.Regfrm.Email.focus();
				return false;
			}
			if (bb==0){
				alert("Invalid E-mail Format");
				document.Regfrm.Email.select();
				document.Regfrm.Email.focus();
				return false;
			}
		}else{
			td="";
		}
	} //end for loop
	if (aa == mail.length-1)
	{
	    alert("Invalid E-mail Format");
		document.Regfrm.Email.select();
		document.Regfrm.Email.focus();
		return false;
	}
	if (bb == mail.length-1)
	{
		alert("Invalid E-mail Format");
		document.Regfrm.Email.select();
		document.Regfrm.Email.focus();
		return false;
	}
	if(aa >= (bb-1))
	{
		alert("Invalid E-mail Format");
		document.Regfrm.Email.select();
		document.Regfrm.Email.focus();
		return false;
	}

	////////###########################################//////////////////////////////
	if(document.Regfrm.Pwd.value=="")
	{
	alert("Password is required.")
	document.Regfrm.Pwd.focus();
	return false;
	}
	var str;
	str=document.Regfrm.Pwd.value;
	if(str.length<6)
	{
	alert("Password Can Not be less than 6 Caracters.")
	document.Regfrm.Pwd.focus();
	return false;
	}
	//For One Alpha And One Numeric	
		 var re1char=/[A-Za-z]/  //regular expression 
		 var re1digit=/[0-9]/
			if ((document.Regfrm.Pwd.value.search(re1char)==-1) || (document.Regfrm.Pwd.value.search(re1digit)==-1) ) //if match failed
			{
			alert("Password has to be alphanumeric.")
			document.Regfrm.Pwd.focus();
			return false;
			
			}
	//For One Alpha And One Numeric	
		
		
		
	if(document.Regfrm.ConfirmPwd.value=="")
	{
	alert("Retype Password.")
	document.Regfrm.ConfirmPwd.focus();
	return false;
	}
	if(document.Regfrm.Pwd.value!=document.Regfrm.ConfirmPwd.value)
	{
	alert("Password Doesn't Match.");
	document.Regfrm.ConfirmPwd.focus();
	return false;
	}
	if(document.Regfrm.SecretQuestion.value=="")
	{
	alert("Select a Secret Question.")
	document.Regfrm.SecretQuestion.focus();
	return false;
	}
	if(document.Regfrm.SecretAnswer.value=="")
	{
	alert("Secret Answer is required.")
	document.Regfrm.SecretAnswer.focus();
	return false;
	}
return true;
}



function validationModFrm()
{
/*if(document.frmEditAcc.NickName.value=="")
{
alert("Nick Name is required.");
document.frmEditAcc.NickName.focus();
return false;
}*/
if(document.frmEditAcc.FirstName.value=="")
{
alert("First Name is required.");
document.frmEditAcc.FirstName.focus();
return false;
}

if(document.frmEditAcc.LastName.value=="")
{
alert("Last Name is required.");
document.frmEditAcc.LastName.focus();
return false;
}
if(document.frmEditAcc.Pwd.value=="")
{
alert("Password is required.");
document.frmEditAcc.Pwd.focus();
return false;
}
var strP;
strP=document.frmEditAcc.Pwd.value;
if (strP.length<=5 )
{
alert("Password Can not be less than six characters")
document.frmEditAcc.Pwd.focus();
return false;
}
if(document.frmEditAcc.ConfirmPwd.value=="")
{
alert("Password Confirmation is required.");
document.frmEditAcc.ConfirmPwd.focus();
return false;
}

if(document.frmEditAcc.Pwd.value!=document.frmEditAcc.ConfirmPwd.value)
{
alert("Password Doesn't Match");
document.frmEditAcc.ConfirmPwd.focus();
return false;
}

if(document.frmEditAcc.Email.value=="")
{
alert("Email Address is required.");
document.frmEditAcc.Email.focus();
return false;
}

if(document.frmEditAcc.CPH1.value=="")
{
alert("ContactPhone  is required.");
document.frmEditAcc.CPH1.focus();
return false;
}
else 
{
	if 	(isNaN(document.frmEditAcc.CPH1.value))
	{
		alert("Contact Phone can have digits only.")	
		document.frmEditAcc.CPH1.focus();
		return false;
	}
	var str=document.frmEditAcc.CPH1.value;
	if(str.length<3)
	{
		alert("InValid Phone Number")
		document.frmEditAcc.CPH1.focus();
		return false;
	}
}

if(document.frmEditAcc.CPH2.value=="")
{
alert("ContactPhone  is required.");
document.frmEditAcc.CPH2.focus();
return false;
}
if(document.frmEditAcc.CPH2.value!="")
{

	if (isNaN(document.frmEditAcc.CPH2.value))
	{
		alert("Contact Phone can have digits only.")	
		document.frmEditAcc.CPH2.focus();
		return false;
	}
	var str=document.frmEditAcc.CPH2.value;
	if(str.length<3)
	{
		alert("InValid Phone Number")
		document.frmEditAcc.CPH2.focus();
		return false;
	}
}


if(document.frmEditAcc.CPH3.value=="")
{
alert("ContactPhone  is required.");
document.frmEditAcc.CPH3.focus();
return false;
}
if(document.frmEditAcc.CPH3.value!="")
{

	if 	(isNaN(document.frmEditAcc.CPH3.value))
	{
		alert("Contact Phone can have digits only.")	
		document.frmEditAcc.CPH3.focus();
		return false;
	}
	var str=document.frmEditAcc.CPH3.value;
	if(str.length<4)
	{
		alert("InValid Phone Number")
		document.frmEditAcc.CPH3.focus();
		return false;
	}
}


if(document.frmEditAcc.CPHA1.value!="")
{

	if 	(isNaN(document.frmEditAcc.CPHA1.value))
	{
		alert("Additional Phone can have digits only.")	
		document.frmEditAcc.CPHA1.focus();
		return false;
	}
	var str=document.frmEditAcc.CPHA1.value;
	if(str.length<3)
	{
		alert("InValid Phone Number")
		document.frmEditAcc.CPHA1.focus();
		return false;
	}
}

if(document.frmEditAcc.CPHA2.value!="")
{

	if 	(isNaN(document.frmEditAcc.CPHA2.value))
	{
		alert("Additional Phone can have digits only.")	
		document.frmEditAcc.CPHA2.focus();
		return false;
	}
	var str=document.frmEditAcc.CPHA2.value;
	if(str.length<3)
	{
		alert("InValid Phone Number")
		document.frmEditAcc.CPHA2.focus();
		return false;
	}
}
if(document.frmEditAcc.CPHA3.value!="")
{

	if 	(isNaN(document.frmEditAcc.CPHA3.value))
	{
		alert("Additional Phone can have digits only.")	
		document.frmEditAcc.CPHA3.focus();
		return false;
	}
	var str1=document.frmEditAcc.CPHA3.value;
	if(str1.length<4)
	{
		alert("InValid Phone Number")
		document.frmEditAcc.CPHA3.focus();
		return false;
	}
}




if(document.frmEditAcc.BillingAddress1.value=="")
{
alert("Billing Address is required.");
document.frmEditAcc.BillingAddress1.focus();
return false;
}

if(document.frmEditAcc.BillingCity.value=="")
{
alert("Billing City is required.");
document.frmEditAcc.BillingCity.focus();
return false;
}

if(document.frmEditAcc.BillCountry.value=="0")
{
alert("Billing Country is required.");
document.frmEditAcc.BillCountry.focus();
return false;
}



if(document.frmEditAcc.BillingState.value=="")
{
alert("Billing State is required.");
document.frmEditAcc.BillingState.focus();
return false;
}

if(document.frmEditAcc.BillingZip.value=="")
{
alert("Billing Zip is required.");
document.frmEditAcc.BillingZip.focus();
return false;
}

if(document.frmEditAcc.MailingAddress1.value=="")
{
alert("Mailing Address1  is required.");
document.frmEditAcc.MailingAddress1.focus();
return false;
}


if(document.frmEditAcc.MailingCity.value=="")
{
alert("Mailing City  is required.");
document.frmEditAcc.MailingCity.focus();
return false;
}

if(document.frmEditAcc.MailCountry.value=="0")
{
alert("Mailing Country is required.");
document.frmEditAcc.MailCountry.focus();
return false;
}
if(document.frmEditAcc.MailingState.value=="")
{
alert("Mailing State  is required.");
document.frmEditAcc.MailingState.focus();
return false;
}
if(document.frmEditAcc.MailingZip.value=="")
{
alert("Mailing Zip  is required.");
document.frmEditAcc.MailingZip.focus();
return false;
}
return true;
}

function validateFpwd()
{

////////////#############3Email Validation#################//////////////
	if (document.UserPwdfrm.Email.value=="")
	{
		alert("Email should not be blank.")
		document.UserPwdfrm.Email.focus();
		return false;
	}

	var str = document.UserPwdfrm.Email.value;   
	if (str.length<=5)
	{
		alert("Email should not be less than 6 characters.")
		document.UserPwdfrm.Email.focus();
		return false;
	}
	
	var mail = document.UserPwdfrm.Email.value;
	if (mail == "")
	{
		alert("Incomplete E-mail Address");
		document.UserPwdfrm.Email.focus();
		return false;
	}
	if (mail.indexOf("@")== -1)
	{
		alert("Invalid E-mail")
		document.UserPwdfrm.Email.select();
		document.UserPwdfrm.Email.focus();
		return false;
	}
	if (mail.indexOf(".")== -1)
	{
		alert("Invalid E-mail")
		document.UserPwdfrm.Email.select();
		document.UserPwdfrm.Email.focus();
		return false;
	}
	var aa=0;
	var bb=0;
	var cc=0;
	var td="";
	for (j =0 ; j<mail.length ;j++)
	{
		if(mail.charAt(j) =="@"){
		aa=j;
		cc=cc+1;
			if ((aa==0) || (cc>1)){
				alert("Invalid E-mail Format");
				document.UserPwdfrm.Email.select();
				document.UserPwdfrm.Email.focus();
				return false;
			}
		}else if(mail.charAt(j)=="."){
		bb=j;
		td=td+mail.charAt(j);
			if(td==".."){
				alert("Invalid E-mail Format");
				document.UserPwdfrm.Email.select();
				document.UserPwdfrm.Email.focus();
				return false;
			}
			if (bb==0){
				alert("Invalid E-mail Format");
				document.UserPwdfrm.Email.select();
				document.UserPwdfrm.Email.focus();
				return false;
			}
		}else{
			td="";
		}
	} //end for loop
	if (aa == mail.length-1)
	{
	    alert("Invalid E-mail Format");
		document.UserPwdfrm.Email.select();
		document.UserPwdfrm.Email.focus();
		return false;
	}
	if (bb == mail.length-1)
	{
		alert("Invalid E-mail Format");
		document.UserPwdfrm.Email.select();
		document.UserPwdfrm.Email.focus();
		return false;
	}
	if(aa >= (bb-1))
	{
		alert("Invalid E-mail Format");
		document.UserPwdfrm.Email.select();
		document.UserPwdfrm.Email.focus();
		return false;
	}
	////////###########################################//////////////////////////////
if(document.UserPwdfrm.AccountNumber.value=="")
{
alert("Your AccountNumber is required")
document.UserPwdfrm.AccountNumber.focus();
return false;
}

return true;
}

function validateans()
{
if(document.UserPwdfrm.SecretAnswer.value=="")
{
alert("Your answer is required.")
document.UserPwdfrm.SecretAnswer.focus();
return false;
}
return true;
}