

//to check password
function validPSWDmainten(fieldChk,keyType)
{ 
var mast ="ctl00_ContentPlaceHolder1_";
var i;
var expChk=/\s/;
var expChk1=new Array("CREATE","INSERT","SELECT","DELETE","DROP","UPDATE","HAVING"); //reserved words
//Add LoginID to the above array
var hLogin=document.getElementById(mast+"txtUserID");
expChk1[7]=hLogin.value
var strChk=document.getElementById(mast+fieldChk).value;
var errCount=0;
var errMsg="";
errMsg="Invalid "+keyType+" ...\n";
//Length Check
if (strChk.length>10 || strChk.length<8)
{
   errCount++;
   errMsg=errMsg+errCount+". Minimum 8 & Maximum 10 Characters are allowed\n";
   
   }
else
{
	//Preceeding/following integer check
	if (("0123456789").indexOf(strChk.substr(0,1)) > -1) 
	{errCount++;errMsg=errMsg+errCount+". Should not start with a digit\n";}
	
	
	if (("0123456789").indexOf(strChk.substr(strChk.length-1,1)) > -1)
	{errCount++;errMsg=errMsg+errCount+". Should not end with a digit\n";}
	
	if (strChk.search(expChk)>-1)
	{errCount++;errMsg=errMsg+errCount+". Should not contain any whitespace character\n";}
	
	//Reserved word (including Login Id)
	for(i=0;i<expChk1.length;i++)
	{
		var chk=new RegExp(expChk1[i]);
		if (strChk.toUpperCase().match(chk))
		{errCount++;errMsg=errMsg+errCount+". Should not contain the user Id or reserved keyword "+expChk1[i]+"\n";break;}
	}

}
if (errCount>0){alert(errMsg);document.getElementById(mast+fieldChk).focus();return false;}
}



function welcomePSWD(fieldChk,keyType)
{ 

var i;
var expChk=/\s/;
var expChk1=new Array("CREATE","INSERT","SELECT","DELETE","DROP","UPDATE","HAVING"); //reserved words
//Add LoginID to the above array
var strChk=document.getElementById(fieldChk).value;
var errCount=0;
var errMsg="";
errMsg="Invalid "+keyType+" ...\n";
//Length Check
if (strChk.length>10 || strChk.length<8)
{
   errCount++;
   errMsg=errMsg+errCount+". Minimum 8 & Maximum 10 Characters are allowed\n";
   
   }
else
{
	//Preceeding/following integer check
	if (("0123456789").indexOf(strChk.substr(0,1)) > -1) 
	{errCount++;errMsg=errMsg+errCount+". Should not start with a digit\n";}
	
	
	if (("0123456789").indexOf(strChk.substr(strChk.length-1,1)) > -1)
	{errCount++;errMsg=errMsg+errCount+". Should not end with a digit\n";}
	
	if (strChk.search(expChk)>-1)
	{errCount++;errMsg=errMsg+errCount+". Should not contain any whitespace character\n";}
	
	//Reserved word (including Login Id)
	for(i=0;i<expChk1.length;i++)
	{
		var chk=new RegExp(expChk1[i]);
		if (strChk.toUpperCase().match(chk))
		{errCount++;errMsg=errMsg+errCount+". Should not contain  reserved keyword "+expChk1[i]+"\n";break;}
	}

}
if (errCount>0){alert(errMsg);document.getElementById(fieldChk).focus();return false;}
}


