function IsVal(msg,val)	
{
if (isNaN(val))
	{
		var write
		write = msg + " has to be Numeric"
		alert(write)
		return false
	}
return true
}

// Check whether string s is empty.
// returns true if the string is empty
function isEmpty(StringToCheck)
{   
		
	return ((StringToCheck == null) || (StringToCheck.length == 0))
}


// Returns true if string s is empty or 
// whitespace characters only.
function isWhitespace (StringToCheck)
{
	var reWhitespace = /^\s+$/
    return (isEmpty(StringToCheck) || reWhitespace.test(StringToCheck));
}


// Returns the string after triming it.
function trimTheString(stringToTrim)
{
	var flag = true;
	var i = 0;
	if (isWhitespace(stringToTrim)==true)
		return "";
	while ((i < stringToTrim.length) && (flag)) {
		retChar = stringToTrim.charAt(i++);
		if (retChar != " ") flag = false;
	}
	if (flag) return "";
	var j = stringToTrim.length-1;
	flag = true;
	while ((j >= 0) && (flag)) {
		retChar = stringToTrim.charAt(j--);
		if (retChar != " ") flag = false;
	}
	if (flag) return "";
	stringToTrim = stringToTrim.substring(i-1,j+2);
	return stringToTrim;
}

//Checks for numeric value.
//it does not allow decimal;

function isInteger (StringToCheck)
{
   	var i;
   	var valid;
   	valid = true;
	var reInteger = /^\d+$/
	if (valid == true && isWhitespace(StringToCheck)) 
       	{
		alert("Field cannot be left blank");
		valid = false;
		return false;
	}
    if ( valid == true  && reInteger.test(StringToCheck) == false)
	{
		alert("Field should contain only numeric value");
		valid = false
		return false;
	}
    if (valid == true  && parseInt(StringToCheck) > 32767 )
	{
		alert("Value of field should not exceed 32767.");
		valid == false 
		return false;
	}
	return true;
}

function isLongInteger (StringToCheck)
{
   	var i;
   	var valid;
   	valid = true;
	var reInteger = /^\d+$/
	if (valid == true && isWhitespace(StringToCheck)) 
       	{
		alert("Field cannot be left blank");
		valid = false;
		return false;
	}
    if ( valid == true  && reInteger.test(StringToCheck) == false)
	{
		alert("Field should contain only numeric value");
		valid = false
		return false;
	}
	return true;
}

//Checks for numeric value.
//it allows decimal;

function isFloat (StringToCheck)

{   
	var reFloat = /^((\d+(\.\d*)?)|((\d*\.)?\d+))$/	
	if (isWhitespace(StringToCheck)) 
       	{
		alert("Field cannot be left blank");
		return false;
	}       
	if (reFloat.test(StringToCheck) == false)
	{
		alert("Field should contain only numeric value");
		return false;
	}
    
}

//Checks for numeric value.
//allows decimal. Allows + or - sign at the begining

function isSignedFloat (StringToCheck)

{   
	var reSignedFloat = /^(((\+|-)?\d+(\.\d*)?)|((\+|-)?(\d*\.)?\d+))$/	
	if (isWhitespace(StringToCheck)) 
       	{
		alert("Field cannot be left blank");
		return false;
	}       
	if (reSignedFloat.test(StringToCheck) == false)
	{
		alert("Field should contain only numeric value");
		return false;
	}

}

//Checks for numeric value.
//allows decimal. Allows + or - sign at the begining
//allows $ sign

function isSignedDollarFloat (StringToCheck)
{   
	var reSignedFloat = /^(((\+|-)\$?\d+(\.\d*)?)|((\+|-)\$?(\d*\.)?\d+))$/	
	if (isWhitespace(StringToCheck)) 
       	{
		alert("Field cannot be left blank");
		return false;
	}       
	if (reSignedFloat.test(StringToCheck) == false)
	{
		alert("Field should contain only numeric value");
		return false;
	}

}

//Checks for Alphbets, lower or upper case.
//allows decimal. Allows + or - sign at the begining
//allows $ sign

function isAlphaOnly (StringToCheck)
{   

	var reAlphabetic = /\d/;
	if (reAlphabetic.test(StringToCheck) == true)
	{
		alert("Field should not contain any numbers ");
		return false;
	}
	else
		return true;
}	

//Checks for Alphbets, lower or upper case.
//allows decimal. Allows + or - sign at the begining
//allows $ sign

function isAlphabetic (StringToCheck)
{   
	var reAlphabetic = /^[a-zA-Z]+$/;
	if (isWhitespace(StringToCheck)) 
       	{
		//alert("Field cannot be left blank");
		return false;
	}       
	if (reAlphabetic.test(StringToCheck) == false)
	{
		//alert("Field should contain only charecters ");
		return false;
	}
}	

//Checks for Alphanumerics, lower or upper case.

function isAlphanumeric (StringToCheck)

{   var reAlphanumeric = /^[a-zA-Z0-9]+$/

    	if (isWhitespace(StringToCheck)) 
       	{
		alert("Field cannot be left blank");
		return false;
	}       
	if (reAlphanumeric.test(StringToCheck) == false)
	{
		alert("Field can contain digits and charecters value");
		return false;
	}
}

function nmIsDate(ctr)
{
 
  if (ctr.value == "")
   {
   return false;
	}
 if (ctr.value.length > 10)
    {
     return false;
    }
     
if(ctr.value.length!=10 && ctr.value.length!=9 && ctr.value.length!=8)
{
   return false;
}


if(ctr.value.length==10)
{
	 if ((ctr.value.charAt(2) != "/") || (ctr.value.charAt(5) != "/"))
     		{
		   return false;
		}
	nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
	numday = ctr.value.charAt(3)+ctr.value.charAt(4)
	numyear = ctr.value.charAt(6)+ctr.value.charAt(7) + ctr.value.charAt(8)+ctr.value.charAt(9)
}

	if(ctr.value.length==8)
		{
			 if ((ctr.value.charAt(1) != "/") || (ctr.value.charAt(3) != "/"))
		     		{
				   return false;
				}
			nummonth = ctr.value.charAt(0)
			numday = ctr.value.charAt(2)
			numyear = ctr.value.charAt(4)+ctr.value.charAt(5) + ctr.value.charAt(6)+ctr.value.charAt(7)
		}	

if(ctr.value.length==9)
	{
		 if (((ctr.value.charAt(1) != "/") || (ctr.value.charAt(4) != "/")) &&((ctr.value.charAt(2) != "/") || (ctr.value.charAt(4) != "/")))
	     		{
			   return false;
			}
		if (ctr.value.charAt(1)== "/") 
			{
			nummonth = ctr.value.charAt(0)
			numday = ctr.value.charAt(2)+ctr.value.charAt(3)
			numyear =ctr.value.charAt(5) + ctr.value.charAt(6)+ctr.value.charAt(7)+ ctr.value.charAt(8)
			}
		else
			{
			nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
			numday = ctr.value.charAt(3)
			numyear =ctr.value.charAt(5) + ctr.value.charAt(6)+ctr.value.charAt(7)+ ctr.value.charAt(8)
			}
	}	



if (numyear.length < 4)
	 {
	  return false;
	 }
	 
	if (!IsVal("Day value in date",numday))
	{
	 return false;
	}
	if (!IsVal("Month value in date",nummonth))
	{
	 return false;
	}
	if (!IsVal("Year value in date",numyear)) 
	{
	 return false;
	}
	day = parseInt(numday,10)
	month = parseInt(nummonth,10)
	year = parseInt(numyear,10)
        if (isNaN(day) || isNaN(month) || isNaN(year))
            {
		return false;
	    }
       
	if ((day < 0) || (month < 0) || (year < 0))
	{
		return false;
	}
	if ((day == 0) || (month == 0) || (year == 0))
	{
		return false;
	}
	   if (month > 12)
	  {
	   return false;
	   }

	  if (day > 31 )
	   {
	     return false;
	   }
	   if ((month==4)||(month==6)||(month==9)||(month==11))
	   {
	       if (day > 30 ) 
	       {
	        return false;
	        }
	   }
	   if (month==2)
	    {
	      if  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) 
	          {
	            
	             if (day > 29)
	                {
	                  return false;
	                }        
	               
	           }  
	           else     
	            {
	                if (day > 28)
	                {
	                  return false;
	                 } 
	             }    
	        }  
	if (numyear < 1900)
	{
		return false;
	}
	return true;
	
}	
function isEmail(StringToCheck,NoAlert)
{
	
	var reEmail = /^.+\@.+\..+$/	
	var numstr =" ~`!#$%^&*()+=[{]}|\<>?,:';";    
	///~`!#$%^&*()+=[{]}|\<>?,:;'\"

	var ThisChar;
	
         
	
	StringToCheck=trimTheString(StringToCheck);
	for(var i=0;i<StringToCheck.length;i++)
	{
	j=i+1;
	ThisChar=StringToCheck.substring(i,j);
		if(numstr.indexOf(ThisChar)!= -1){		
			alert("Please enter Valid Email address");
			return false;
			}
	}
	if (NoAlert == "1")
	{
		if (reEmail.test(StringToCheck) == false)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	
	if (reEmail.test(StringToCheck) == false)
	{
		alert("Sorry, Special Character are Not allowed in this Field");
		return false;
	}
	return true;
}
/*
This function validEmail is created on 07/05/2004 by Shailja for vendorInformation.asp. just for the change of msg.
*/
function validEmail(StringToCheck,NoAlert)
{
	
	var reEmail = /^.+\@.+\..+$/	
	var numstr =" ~`!#$%^&*()+=[{]}|\<>?,:';";    
	///~`!#$%^&*()+=[{]}|\<>?,:;'\"

	var ThisChar;
	
         
	
	StringToCheck=trimTheString(StringToCheck);
	for(var i=0;i<StringToCheck.length;i++)
	{
	j=i+1;
	ThisChar=StringToCheck.substring(i,j);
		if(numstr.indexOf(ThisChar)!= -1){		
			alert("Please enter Valid Email address");
			return false;
			}
	}
	if (NoAlert == "1")
	{
		if (reEmail.test(StringToCheck) == false)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	
	if (reEmail.test(StringToCheck) == false)
	{
		alert("Please enter Valid Email address");
		return false;
	}
	return true;
}

// This function is used so that no internal messages are returned
// Used in ValidateZip function.
function isIntegerNoMsg (StringToCheck)
{
   	var i;
   	var valid;
   	valid = true;
	var reInteger = /^\d+$/
	if (valid == true && isWhitespace(StringToCheck)) 
       	{
		alert("Field cannot be left blank");
		valid = false;
		return false;
	}
    if ( valid == true  && reInteger.test(StringToCheck) == false)
	{
		valid = false
		return false;
	}
	return true;
}

	function Validate_SSN(FieldValue)
	{
	
		var TempFieldValue;
		var FirstPart;
		var SecondPart;
		var ThirdPart;
		var reInteger = /^\d+$/
						 
		TempFieldValue= new String(FieldValue);
		TempFieldValue=trimTheString(TempFieldValue);
		
		if (TempFieldValue.indexOf("-") == -1)
		{
			
			if (reInteger.test(TempFieldValue) == false)
			{
				alert("The Social Security Number should be a numeric value.");
				return false;
			}
			if(TempFieldValue.length!=9)
			
			{
				alert("The Social Security Number should have nine digits.");
				return false;
			}
		}		
		else
		{
			if(TempFieldValue.length!=11)
			{
				alert("The Social Security Number should be specified in NNN-NN-NNNN format.");
				return false;
			}
			if (TempFieldValue.charAt(3)!="-" ||TempFieldValue.charAt(6)!="-")
			{
				alert("The Social Security Number should be specified in NNN-NN-NNNN format.");
				return false;
			}
			
			FirstPart=TempFieldValue.substr(0,3);
			SecondPart=TempFieldValue.substr(4,2);
			ThirdPart=TempFieldValue.substr(7,4);
			if (reInteger.test(FirstPart) == false ||reInteger.test(SecondPart) == false ||reInteger.test(ThirdPart) == false)
			{
				alert("The Social Security Number should be specified in NNN-NN-NNNN format.");
				return false;
			}
		}
		return true;
   } 


   function Validate_Time(FieldValue)
	{

	var TempFieldValue;
	var TempHour;
	var TempMinute;
	var Devider;
	var reInteger = /^\d+$/
	
	FieldValue=trimTheString(FieldValue);
	
	TempFieldValue= new String(FieldValue)
	if (TempFieldValue.length<4 || TempFieldValue.length>5)
	{
		alert("Invalid Time");
		return false;
	}
	
	if (TempFieldValue.indexOf(".")!=-1)
	{
		alert("The Time should be specified in HH:MM format.");
		return false;
	}  
	
	if (TempFieldValue.length==5)
	{
		Devider=TempFieldValue.substr(2,1);
		if (Devider!=":")
		{
			alert("The Time should be specified in HH:MM format.");
			return false;
		}
		  
	}
	
	if (TempFieldValue.indexOf(":")==-1)
	{
		TempHour=TempFieldValue.substr(0,2);
		TempMinute=TempFieldValue.substr(2,2);
	}
	else
	{
		TempHour=TempFieldValue.substr(0,2);
		TempMinute=TempFieldValue.substr(3,2);
	}
	
	if (reInteger.test(TempHour) == false || reInteger.test(TempMinute) == false)
	//if (isNaN(TempHour)==true || isNaN(TempMinute)==true)
	{
		alert("The Time should be specified in HH:MM format.");
		return false;
	}
	else
	{
		if (parseInt(TempHour)>23 || parseInt(TempHour)<0)
		{
			alert("The hour value should not exceed 23.");
			return false;
		}
		if (parseInt(TempMinute)>59 || parseInt(TempMinute)<0)
		{
			alert("The minute value should not exceed 59.");
			return false;
		}	
	}
	return true
}


function GenCode(NameObj, CodeObj)
{
	if (trimTheString(NameObj.value) != "" && trimTheString(CodeObj.value) == "")
	{
		var lstrSource, lstrCode, lintFirstSpace, lstrFirstWord, lstrSecondWord;
		lstrSource = new String(trimTheString(NameObj.value));
		lintFirstSpace = lstrSource.indexOf(" ");
		if ( lintFirstSpace >=2 && (lstrSource.length - lintFirstSpace) > 2)
		{
			lstrFirstWord  = lstrSource.substring(0,lintFirstSpace);
			lstrSecondWord  = lstrSource.substring(lintFirstSpace+1, lstrSource.length);
			lstrCode = lstrFirstWord.substring(0,2) + lstrSecondWord.substring(0,2);
			lstrCode = lstrCode.toUpperCase();
		}
		else
		{
			if (lintFirstSpace >= 4 || lintFirstSpace == -1)
				lstrCode = lstrSource.substring(0,4);
			else
				lstrCode = trimTheString(lstrSource.substring(0,2)) + "01";
		}
		CodeObj.value = lstrCode;
	}
}

function GenVendorCode(NameObj, CodeObj)
{
	if (trimTheString(NameObj.value) != "" && trimTheString(CodeObj.value) == "")
	{
		var lstrSource, lstrCode, lintFirstSpace, lstrFirstWord, lstrSecondWord;
		lstrSource = new String(trimTheString(NameObj.value));
		lintFirstSpace = lstrSource.indexOf(" ");
		if ( lintFirstSpace >=2 && (lstrSource.length - lintFirstSpace) > 2)
		{
			lstrFirstWord  = lstrSource.substring(0,lintFirstSpace);
			lstrSecondWord  = lstrSource.substring(lintFirstSpace+1, lstrSource.length);
			lstrCode = lstrFirstWord.substring(0,3) + lstrSecondWord.substring(0,3);
			lstrCode = lstrCode.toUpperCase();
		}
		else
		{
			if (lintFirstSpace >= 6 || lintFirstSpace == -1)
				lstrCode = lstrSource.substring(0,6);
			else
				lstrCode = trimTheString(lstrSource.substring(0,2)) + "01";
		}
		CodeObj.value = lstrCode;
	}
}



// Parameter 'ShowAll' added by RSham on 03July2001
// When 'ShowAll' = 1, all the NAIC Carriers are displayed in the Popup.
// One Parameter (named CarrierType)is added to  this function on 4th March 2002. This parameter is passed from 
// AddEditCompanies.asp. The use of this parameter is to identify whther to show all the NAIC Codes From Carrier_Master table,
// or to show only those NAIC codes that are already assigned to some Issuing Carriers.
   
function ShowWindow(formName, txtFieldName, selValue, DisplayFlag, callSpecialFunction, ShowAll, CarrierType)
{ 
//	alert(ShowAll);
//	alert(CarrierType);
	var lstr, lloc, ldesc;
	
	ldesc = selValue.value;
	lloc = ldesc.indexOf(":");
	ldesc = ldesc.substring(lloc+1, ldesc.length);
	ldesc = trimTheString(ldesc);
	
	if (CarrierType!='I') 
	{
		if (CarrierType!='BIL')
		{
			CarrierType = ""
		}
	}
	
	if (ShowAll == '1')
	{
		lstr = "../Search/NaicPopUp.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&CallFunction=" + callSpecialFunction + "&ShowAll=1"
	}
	else
	{
		lstr = "../Search/NaicPopUp.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&CallFunction=" + callSpecialFunction +"&CarrierType="+ CarrierType;
	}
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//newWindow = window.open(lstr,"NewMainPageWindow","toolbar=no,width=375,height=450,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
	ShowPopup(lstr, "NewMainPageWindow", 375,450)
}

//for binders
function ShowWindowBinder(formName, txtFieldName, selValue, DisplayFlag, callSpecialFunction)
{ 
	var lstr, lloc, ldesc;
	
	ldesc = selValue.value;
	lloc = ldesc.indexOf(":");
	ldesc = ldesc.substring(lloc+1, ldesc.length);
	ldesc = trimTheString(ldesc);
	lstr = "../../Search/NaicPopUp.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&CallFunction=" + callSpecialFunction;
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//newWindow = window.open(lstr,"NewMainPageWindow","toolbar=no,width=375,height=450,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
	ShowPopup(lstr,"NewMainPageWindow",375,450)
}


function ShowWindow1(formName, txtFieldName, selValue, DisplayFlag)
{ 
	var lstr, lloc, ldesc;
	
	ldesc = selValue.value;
	lloc = ldesc.indexOf(":");
	ldesc = ldesc.substring(lloc+1, ldesc.length);
	ldesc = trimTheString(ldesc);
	lstr = "../Search/HoldIntPopUp.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag;
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//newWindow = window.open(lstr,"NewMainPageWindow","toolbar=no,width=375,height=450,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
	ShowPopup(lstr,"NewMainPageWindow",900,500)
}

function ShowLookUpWindow(formName, txtFieldName, lookUpCode, selValue, DisplayFlag, DisplaySaveFlag, ReturnCode,submitFormFunc,submitFuncName)
{ 
	var lstr, lloc, ldesc;
	ldesc = selValue.value;
	lloc = ldesc.indexOf(":");
	
	ldesc = ldesc.substring(lloc+1, ldesc.length);
	ldesc = trimTheString(ldesc)
	
	lstr = "../Search/LookUpPage.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&LookUpID=" + escape(lookUpCode) +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&DisplaySaveFlag=" + DisplaySaveFlag  + "&ReturnCode=" + ReturnCode + "&submitFormFunc=" + submitFormFunc + "&submitFuncName=" + submitFuncName
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//newWindow = window.open(lstr,"NewMainPageWindow","toolbar=no,width=400,height=600,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
	ShowPopup(lstr,"NewMainPageWindow",435,610)
}

function ShowLookUpWindowForAddInt(formName, txtFieldName, lookUpCode, selValue, DisplayFlag, DisplaySaveFlag, ReturnCode,submitFormFunc,submitFuncName,vehId)
{ 
	var lstr, lloc, ldesc;
	ldesc = selValue.value;
	lloc = ldesc.indexOf(":");
	ldesc = ldesc.substring(lloc+1, ldesc.length);
	ldesc = trimTheString(ldesc)
	lstr = "../Search/AddIntPopUp.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&LookUpID=" + escape(lookUpCode) +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&DisplaySaveFlag=" + DisplaySaveFlag  + "&ReturnCode=" + ReturnCode + "&submitFormFunc=" + submitFormFunc + "&submitFuncName=" + submitFuncName + "&vehId=" + vehId
	ShowPopup(lstr,"NewMainPageWindow",900,425)
}

function ShowLookUpWindowForAddInsurance(formName, txtFieldName, lookUpCode, selValue, DisplayFlag, DisplaySaveFlag, ReturnCode,submitFormFunc,submitFuncName,vehId)
{ 
	var lstr, lloc, ldesc;
	ldesc = selValue.value;
	lloc = ldesc.indexOf(":");
	ldesc = ldesc.substring(lloc+1, ldesc.length);
	ldesc = trimTheString(ldesc)
	lstr = "../Search/AddIntPopUpInsurance.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&LookUpID=" + escape(lookUpCode) +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&DisplaySaveFlag=" + DisplaySaveFlag  + "&ReturnCode=" + ReturnCode + "&submitFormFunc=" + submitFormFunc + "&submitFuncName=" + submitFuncName + "&vehId=" + vehId
	ShowPopup(lstr,"NewMainPageWindow",900,455)
}


function ShowTransLookUpWindow(formName, txtBaseName, selValue)
{ 
	var lstr, lloc, ldesc;
	ldesc = selValue.value;
	
	lstr = "../BankAccount/DefaultTranCodePopUp.asp?FormName=" + formName + "&BaseName=" + txtBaseName +"&DefaultValue=" + ldesc
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//newWindow = window.open(lstr,"NewMainPageWindow","toolbar=no,width=400,height=500,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
	ShowPopup(lstr, "NewMainPageWindow", 400, 500)
}

//One for value covgCode added by Rahul on 16 Oct 2003
function ShowLookUpWindow1(formName, txtFieldName, lookUpCode, selValue, DisplayFlag, DisplaySaveFlag, ReturnCode, covgCode)
{ 
	var lstr, lloc, ldesc;
	ldesc = selValue;
	lloc = ldesc.indexOf(":");
	
	ldesc = ldesc.substring(lloc+1, ldesc.length);
	ldesc = trimTheString(ldesc)
	
	//lstr = "../Search/LookUpPage.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&LookUpID=" + escape(lookUpCode) +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&DisplaySaveFlag=" + DisplaySaveFlag  + "&ReturnCode=" + ReturnCode
	//Changed by Rahul on 16 Oct 2003
	//to pass covgCode in the query string
	lstr = "../Search/LookUpPage.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&LookUpID=" + escape(lookUpCode) +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&DisplaySaveFlag=" + DisplaySaveFlag  + "&ReturnCode=" + ReturnCode + "&CovgCode=" + covgCode
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//newWindow = window.open(lstr,"NewMainPageWindow","toolbar=no,width=400,height=600,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
	ShowPopup(lstr,"NewMainPageWindow",435,610)
}

//Added by Balaji. V on 8/April/2002 for People's Choice....
function PC_ShowLookUpWindow(formName, txtFieldName, lookUpCode, selValue, DisplayFlag, DisplaySaveFlag, ReturnCode,submitFormFunc,submitFuncName, LookupFor)
{ 
	var lstr, lloc, ldesc;
	ldesc = selValue.value;
	lloc = ldesc.indexOf(":");
	
	ldesc = ldesc.substring(lloc+1, ldesc.length);
	ldesc = trimTheString(ldesc)
	
	lstr = "../Search/LookUpPage.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&LookUpID=" + escape(lookUpCode) +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&DisplaySaveFlag=" + DisplaySaveFlag  + "&ReturnCode=" + ReturnCode + "&submitFormFunc=" + submitFormFunc + "&submitFuncName=" + submitFuncName + "&LookupFor=" + LookupFor
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//newWindow = window.open(lstr,"NewMainPageWindow","toolbar=no,width=400,height=600,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
	ShowPopup(lstr,"NewMainPageWindow",435,610)
}


// func


// for BOP
function BusinessOwners(FormId, QuestionId, DisplayText, Location, SubLocation) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('AcceptRemark.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText  + '&Location=' + Location  + '&SubLocation=' + SubLocation ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('AcceptRemark.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText  + '&Location=' + Location  + '&SubLocation=' + SubLocation ,"Remarks",265,195,0,0)
}
function OpenPolicyRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

function OpenBOPPolicyRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText + '&CalledFrom=Mech' ,"Remarks",265,195,0,0)
}

function OpenCrimeWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('../Cgl/PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

function OpenCrimeRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('CrimeRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

// for Workers Compensation
function OpenWorkCompenRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('WorkCompenRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('WorkCompenRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

function OpenRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('RemarksAcceptance.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('RemarksAcceptance.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

function OpenFarmRemarksWindow(FormId, QuestionId, DisplayText,LocationId,SubLocationId,selType) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('IndividualLife_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText + '&EmpID=' + EmployeeID,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('RemarksAcceptance.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText + '&LocationID=' + LocationId + '&SubLocationId=' + SubLocationId + '&selType=' + selType ,"Remarks",265,195,0,0)
}



// for Peoples Choice=>Peoples Choice - Home Details
function PC_HD_RemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('Truckers_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('HD_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

// for Peoples Choice=>Peoples Choice - Home Details (generic)
function PC_HD_RemarksWindow1(FormId, QuestionId, DisplayText, ImgDispVal)
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('Truckers_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('HD_RemarksGen.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText + '&ImgDispVal=' + ImgDispVal,"Remarks",265,195,0,0)
}

// for Peoples Choice=>Peoples Choice - Motor (for multiple vehicles)
function PC_MT_EntityRemarksWindow(FormId, QuestionId, ImgDispVal, EntityType, DisplayText)
{
	ShowPopupParams('PC_Entity_PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText + '&ImgDispVal=' + ImgDispVal + '&EntityType=' + EntityType,"Remarks",265,195,0,0)
}

// for Truckers
function OpenTruckersRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('Truckers_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('Truckers_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}
// for Water Crafts
function OpenWaterCraftsRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('Watercrafts_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('Watercrafts_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

// for Individual Life
function OpenIndivdualLifeRemarksWindow(FormId, QuestionId, DisplayText, EmployeeID) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('IndividualLife_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText + '&EmpID=' + EmployeeID,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('IndividualLife_Remarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText + '&EmpID=' + EmployeeID,"Remarks",265,195,0,0)
}

//for Comm. Gen. Liability
function OpenCGLRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}
function OpenCGLRemarksWindow1(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('CGLPolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('CGLPolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

//for Comm. Property
function OpenCommPropRemarksWindow(FormId, QuestionId, DisplayText) 
{	
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('CommPropPolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('CommPropPolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}
// for Mobile Home in Identified Risk
function OpenPolicyRemarksWindowMobileHome(EntityID,QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('MobileHomeRemarks.asp?EntityID=' + EntityID + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('MobileHomeRemarks.asp?EntityID=' + EntityID + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}

// for Commercial Umbrella
function OpenPolicyRemarksWindow1(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('CumbPolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	ShowPopupParams('CumbPolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
}
// for Personal Umbrella
function OpenPersUmbrellaRemarksWindow(FormId, QuestionId, DisplayText) 
{
	// Commented by Piyush on 18 Sep 2001
	// To open the new window in centre
	//var nuWin=window.open('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,'Remarks','menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no,status=no,width=265,height=195,top=286,left=380');
	
	if (FormId == "542" && (QuestionId == "103" || QuestionId == "115" || QuestionId == "105") )
	{
		ShowPopupParams('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",500,300,0,0)
	}
	
	else if (QuestionId == "329")
	{
		ShowPopupParams('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",500,220,0,0)
	}	
	
	
	else if (QuestionId == "110")
	{
		ShowPopupParams('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",500,400,0,0)
	}
	
	else
	{
		ShowPopupParams('PolicyRemarks.asp?FormId=' + FormId + '&QuestionId=' + QuestionId + '&DisplayText=' + DisplayText ,"Remarks",265,195,0,0)
	}
}


function getDefaultValues()
{
	var nItemCount, szElementType;
	var defVal = "", defName = "";
	var defDesc, szfrom, szto, sztag = "";
	var enameVal,ishidTag = "";
	
	document.forms[0].hidDefaultValues.value = "";
	document.forms[0].hidDefaultNames.value = "";
	document.forms[0].txtEndorsements.value = "";
	if (document.forms[0].hidTag)
	{
		document.forms[0].hidTag.value = "";
	}
	nItemCount = document.forms[0].elements.length;
	if (document.forms[0].hidSet.value != "1")
	{
		for(var nCounter=0; nCounter<nItemCount; nCounter++)
		{
			enameVal = document.forms[0].elements[nCounter].ename;
			sztag = document.forms[0].elements[nCounter].tag;
			ishidTag = document.forms[0].hidTag;
			szElementType = document.forms[0].elements[nCounter].type;
			defName = document.forms[0].elements[nCounter].name;
//			if (szElementType != "hidden")
			if (trimTheString(enameVal) != "" )
			{
				if (szElementType == "select-one")
				{
					if (document.forms[0].elements[nCounter].length == 1)
					{
						defVal = document.forms[0].elements[nCounter].options[0].text;
					}
					else
					{
						for(var optCounter=0; optCounter<document.forms[0].elements[nCounter].length; optCounter++)
						{
							if(document.forms[0].elements[nCounter].options[optCounter].selected)
							{
								defVal = document.forms[0].elements[nCounter].options[optCounter].text;
								break;
							}
						}
					}
					document.forms[0].hidDefaultValues.value = document.forms[0].hidDefaultValues.value + defVal + "~" ;
					document.forms[0].hidDefaultNames.value = document.forms[0].hidDefaultNames.value + defName + "~" ;
					if (sztag && ishidTag)
					{
						if (document.forms[0].hidTag.value != "")
						{
							if (defVal != "")
							{
								if (enameVal)
								{
									document.forms[0].hidTag.value = document.forms[0].hidTag.value + ", " + enameVal + "-" + defVal;
								}
							}
						}
						else
						{
							if (enameVal)
							{
								document.forms[0].hidTag.value = document.forms[0].hidTag.value + enameVal + "-" + defVal;
							}
						}
					}
					defVal = "";
				}
				else if (szElementType == "select-multiple")
				{
					if (document.forms[0].elements[nCounter].length == 1)
					{
						defVal = document.forms[0].elements[nCounter].options[0].text;
					}
					else
					{
						for(var optCounter=0; optCounter<document.forms[0].elements[nCounter].length; optCounter++)
						{
							if(document.forms[0].elements[nCounter].options[optCounter].selected)
							{
								if (trimTheString(defVal) != "")
								{
									defVal = defVal + ", " + document.forms[0].elements[nCounter].options[optCounter].text;
								}
								else
								{
									defVal = document.forms[0].elements[nCounter].options[optCounter].text;
								}
							}
						}
					}
					document.forms[0].hidDefaultValues.value = document.forms[0].hidDefaultValues.value + defVal + "~" ;
					document.forms[0].hidDefaultNames.value = document.forms[0].hidDefaultNames.value + defName + "~" ;
					if (sztag && ishidTag)
					{
						if (document.forms[0].hidTag.value != "")
						{
							if (defVal != "")
							{
								if (enameVal)
								{
									document.forms[0].hidTag.value = document.forms[0].hidTag.value + ", " + enameVal + "-" + defVal;
								}
							}
						}
						else
						{
							if (enameVal)
							{
								document.forms[0].hidTag.value = document.forms[0].hidTag.value + document.forms[0].elements[nCounter].ename + "-" + defVal;
							}
						}
					}
					defVal = "";
				}
				else if (szElementType == "radio")
				{
					if (document.forms[0].elements[nCounter].defaultChecked && document.forms[0].elements[nCounter].checked)
					{
						defChecked = document.forms[0].elements[nCounter].value;
						defDesc = document.forms[0].elements[nCounter].desc;
						document.forms[0].hidDefaultValues.value = document.forms[0].hidDefaultValues.value + defChecked + "~" ;
						document.forms[0].hidDefaultNames.value = document.forms[0].hidDefaultNames.value + defName + "~" ;
						if (sztag && ishidTag)
						{
							if (document.forms[0].hidTag.value != "")
							{
								if (enameVal)
								{
									document.forms[0].hidTag.value = document.forms[0].hidTag.value + ", " + document.forms[0].elements[nCounter].ename + "-" + defChecked;
								}
							}
							else
							{
								if (enameVal)
								{
									document.forms[0].hidTag.value = document.forms[0].hidTag.value + document.forms[0].elements[nCounter].ename + "-" + defChecked;
								}
							}
						}
					}
					else
					{
						document.forms[0].hidDefaultValues.value = document.forms[0].hidDefaultValues.value + "" + "~" ;
						document.forms[0].hidDefaultNames.value = document.forms[0].hidDefaultNames.value + "" + "~" ;
					}
				}
				else if (szElementType == "checkbox")
				{
					document.forms[0].hidDefaultValues.value = document.forms[0].hidDefaultValues.value + document.forms[0].elements[nCounter].checked + "~" ;
					document.forms[0].hidDefaultNames.value = document.forms[0].hidDefaultNames.value + defName + "~" ;
					if (sztag && ishidTag)
					{
						if (document.forms[0].hidTag.value != "")
						{
							if (enameVal)
							{
								document.forms[0].hidTag.value = document.forms[0].hidTag.value + ", " + document.forms[0].elements[nCounter].ename + "-" + document.forms[0].elements[nCounter].checked;
							}
						}
						else
						{
							if (enameVal)
							{
								document.forms[0].hidTag.value = document.forms[0].hidTag.value + document.forms[0].elements[nCounter].ename + "-" + document.forms[0].elements[nCounter].checked;
							}
						}
						if (enameVal)
						{
							document.forms[0].hidTag.value = document.forms[0].hidTag.value + document.forms[0].elements[nCounter].ename + "-" + document.forms[0].elements[nCounter].checked + ", ";
						}
					}
				}
				else
				{
					document.forms[0].hidDefaultValues.value = document.forms[0].hidDefaultValues.value + document.forms[0].elements[nCounter].defaultValue + "~" ;
					document.forms[0].hidDefaultNames.value = document.forms[0].hidDefaultNames.value + defName + "~" ;
					if (sztag && ishidTag)
					{
						if (document.forms[0].hidTag.value != "")
						{
							if (document.forms[0].elements[nCounter].defaultValue != "")
							{
								if (enameVal)
								{
									document.forms[0].hidTag.value = document.forms[0].hidTag.value + ", " + document.forms[0].elements[nCounter].ename + "-" + document.forms[0].elements[nCounter].defaultValue;
								}
							}
						}
						else
						{
							if (enameVal)
							{
								document.forms[0].hidTag.value = document.forms[0].hidTag.value + document.forms[0].elements[nCounter].ename + "-" + document.forms[0].elements[nCounter].defaultValue;
							}
						}
					}
				}
			}
			else
			{
				document.forms[0].hidDefaultValues.value = document.forms[0].hidDefaultValues.value + "" + "~" ;
				document.forms[0].hidDefaultNames.value = document.forms[0].hidDefaultNames.value + "" + "~" ;
			}
		}
		document.forms[0].hidSet.value = "1";
		//alert(document.forms[0].hidTag.value);
	}
	//alert(document.forms[0].hidDefaultNames.value);
	//alert(document.forms[0].hidDefaultValues.value);
}

function findChanged(szTag)
{
	var endorsementText="";
	var nItemCount, szElementType;
	var defVal = "",defVal1 = "",defVal2 = "", defCodeValue=""
	var defDesc, szfrom, szto, szName;
	var valueArray, s, nameArray;
	var arrCounter = 0, ctr = 0;
	var FinalXMLString, XMLAttribs, XMLTag, XMLValue, XMLNodeName
	s = document.forms[0].hidDefaultValues.value;
	valueArray = s.split("~");
	s = document.forms[0].hidDefaultNames.value;
	nameArray = s.split("~");
	var sp, rep="";
	var enameVal,radtemp = "0";
	document.forms[0].txtEndorsements.value = "";
	XMLAttribs = '';
	XMLTag = ""
	nItemCount = document.forms[0].elements.length;
	for(var nCounter=0; nCounter<nItemCount; nCounter++)
	{
		enameVal = document.forms[0].elements[nCounter].ename
		XMLTag = enameVal;

		if (XMLTag != null )
		{
			XMLTag = ReplaceString(XMLTag, " ", "_")
			XMLTag = XMLTag.toUpperCase();
		}
		sp = document.forms[0].elements[nCounter].sp;
		szElementType = document.forms[0].elements[nCounter].type;
		if (enameVal)
		{
			if (szElementType == "select-one")
			{
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text != valueArray[nCounter])
						{
							if (enameVal)
							{
								ctr++;
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text + "</b>";
								XMLValue = document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

								XMLValue = document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
							}
						}
					}
				}
				else
				{
					if (document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text != valueArray[nCounter])
					{
						if (enameVal)
						{
							ctr++;
							endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text + "</b>";
							XMLValue = document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLValue = document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
				}
			}
			else if (szElementType == "select-multiple")
			{
				defVal = "";
				for(var optCounter=0; optCounter<document.forms[0].elements[nCounter].length; optCounter++)
				{
					if(document.forms[0].elements[nCounter].options[optCounter].selected)
					{
						if (trimTheString(defVal) != "")
						{
							defVal = defVal + ", " + document.forms[0].elements[nCounter].options[optCounter].text;
							defCodeValue = defCodeValue + ", " + document.forms[0].elements[nCounter].options[optCounter].value
						}
						else
						{
							defVal = document.forms[0].elements[nCounter].options[optCounter].text;
							defCodeValue = document.forms[0].elements[nCounter].options[optCounter].value
						}
					}
				}
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (defVal != valueArray[nCounter])
						{
							if (enameVal)
							{
								ctr++;
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + defVal + "</b>";
								XMLValue = defVal;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

								XMLValue = defCodeValue
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
							}
						}
					}
				}
				else
				{
					if (defVal != valueArray[nCounter])
					{
						if (enameVal)
						{
							ctr++;
							endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + defVal + "</b>";
							XMLValue = defVal;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLValue = defCodeValue
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
				}
				defVal = "";
			}
			else if (szElementType == "radio")
			{
				for (arrCounter=0; arrCounter<nameArray.length; arrCounter++)
				{
					if (document.forms[0].elements[nCounter].name == nameArray[arrCounter])
					{
						break;
					}
				}
				if (nameArray[arrCounter])
				{
					radtemp = "1";
					defDesc = document.forms[0].elements[arrCounter].desc;
				}
				else
				{
					radtemp = "0";
				}
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (document.forms[0].elements[nCounter].value != valueArray[arrCounter] && document.forms[0].elements[nCounter].checked && radtemp == "1")
						{
							if (enameVal)
							{
								ctr++;
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + defDesc + "</b> To: <b>" + document.forms[0].elements[nCounter].desc + "</b>";
								XMLValue = document.forms[0].elements[nCounter].desc;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "
								
								XMLValue = document.forms[0].elements[nCounter].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
							}
						}
						else if ( radtemp == "0")
						{
							if (document.forms[0].elements[nCounter].checked && enameVal)
							{
								ctr++;
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + ": <b>" + document.forms[0].elements[nCounter].desc + "</b>";
								XMLValue = document.forms[0].elements[nCounter].desc;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

								XMLValue = document.forms[0].elements[nCounter].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
							}
						}
					}
				}
				else
				{
					if (document.forms[0].elements[nCounter].value != valueArray[arrCounter] && document.forms[0].elements[nCounter].checked && radtemp == "1")
					{
						if (enameVal)
						{
							ctr++;
							endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + defDesc + "</b> To: <b>" + document.forms[0].elements[nCounter].desc + "</b>";
							XMLValue = document.forms[0].elements[nCounter].desc;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLValue = document.forms[0].elements[nCounter].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
					else if ( radtemp == "0")
					{
						if (document.forms[0].elements[nCounter].checked && enameVal)
						{
							ctr++;
							endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + ": <b>" + document.forms[0].elements[nCounter].desc + "</b>";
							XMLValue = document.forms[0].elements[nCounter].desc;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLValue = document.forms[0].elements[nCounter].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
				}
			}
			else if (szElementType == "checkbox")
			{
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (new String(document.forms[0].elements[nCounter].checked) != valueArray[nCounter])
						{
							if (document.forms[0].elements[nCounter].checked)
							{
								szfrom = "Unchecked";
								szto = "Checked";
							}
							else
							{
								szfrom = "Checked";
								szto = "Unchecked";
							}
							if (enameVal)
							{
								ctr++;
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + szfrom + "</b> To: <b>" + szto + "</b>";
								XMLValue = szto;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "

								XMLValue = document.forms[0].elements[nCounter].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "'  "
							}
						}
					}
				}
				else
				{
					if (new String(document.forms[0].elements[nCounter].checked) != valueArray[nCounter])
					{
						if (document.forms[0].elements[nCounter].checked)
						{
							szfrom = "Unchecked";
							szto = "Checked";
						}
						else
						{
							szfrom = "Checked";
							szto = "Unchecked";
						}
						if (enameVal)
						{
							ctr++;
							endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + szfrom + "</b> To: <b>" + szto + "</b>";
							XMLValue = szto;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
						}
					}
				}
			}
			else
			{
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (document.forms[0].elements[nCounter].value != valueArray[nCounter])
						{
							if (enameVal)
							{
								ctr++;
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + document.forms[0].elements[nCounter].value + "</b>";
								XMLValue = document.forms[0].elements[nCounter].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
							}
						}
					}
				}
				else
				{
					if (document.forms[0].elements[nCounter].value != valueArray[nCounter])
					{
						if (enameVal)
						{
							ctr++;
							endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + document.forms[0].elements[nCounter].value + "</b>";
							XMLValue = document.forms[0].elements[nCounter].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
						}
					}
				}
			}
		}
	}
	
	if (trimTheString(XMLAttribs) != "" && document.forms[0].txtXMLNodeName && document.forms[0].txtXMLEndorsement)
	{
		XMLNodeName	= document.forms[0].txtXMLNodeName.value;
		XMLAttribs = "<" + XMLNodeName + " PrimaryParams='' id1='' " + XMLAttribs + "/>"
		document.forms[0].txtXMLEndorsement.value = XMLAttribs;
	}
	if (document.forms[0].hidTag)
		{
		rep = document.forms[0].hidTag.value;
		szTag = szTag.replace("@substituteinfo",rep);
	}
	if (trimTheString(endorsementText) != "")
	{
		endorsementText = szTag + " :\n" + endorsementText;
		document.forms[0].txtEndorsements.value = endorsementText;
	}
	//alert(document.forms[0].txtEndorsements.value);
}

//FINDCHANGED FUNCTION FOR MERGED TABLES FORM

function findChangedMerge(szTag)
{
	var endorsementText="";
	var nItemCount, szElementType;
	var defVal = "",defVal1 = "",defVal2 = "", defCodeValue=""
	var defDesc, szfrom, szto, szName;
	var valueArray, s, nameArray;
	var arrCounter = 0, ctr = 0;
	var FinalXMLString, XMLAttribs, XMLTag, XMLValue, XMLNodeName
	s = document.forms[0].hidDefaultValues.value;
	valueArray = s.split("~");
	s = document.forms[0].hidDefaultNames.value;
	nameArray = s.split("~");
	var sp, rep="";
	var enameVal,radtemp = "0";
	document.forms[0].txtEndorsements.value = "";
	XMLAttribs = '';
	XMLTag = ""

	nItemCount = document.forms[0].elements.length;
	for(var nCounter=0; nCounter<nItemCount; nCounter++)
	{
		enameVal = document.forms[0].elements[nCounter].ename
		XMLTag = enameVal;

		if (XMLTag != null )
		{
			XMLTag = ReplaceString(XMLTag, " ", "_")
			XMLTag = XMLTag.toUpperCase();
		}
		sp = document.forms[0].elements[nCounter].sp;
		szElementType = document.forms[0].elements[nCounter].type;
		if (enameVal)
		{
			if (szElementType == "select-one")
			{
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text != valueArray[nCounter])
						{
							if (enameVal)
							{
								ctr++;
								if (trimTheString(valueArray[nCounter])=="")
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text + "</b>";
								}
								else
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text + "</b>";
								}
								XMLValue = document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

								XMLValue = document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
							}
						}
					}
				}
				else
				{
					if (document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text != valueArray[nCounter])
					{
						if (enameVal)
						{
							ctr++;
							if (trimTheString(valueArray[nCounter])=="")
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text + "</b>";
							}
							else
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text + "</b>";
							}
							XMLValue = document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].text;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLValue = document.forms[0].elements[nCounter].options[document.forms[0].elements[nCounter].selectedIndex].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
				}
			}
			else if (szElementType == "select-multiple")
			{
				defVal = "";
				for(var optCounter=0; optCounter<document.forms[0].elements[nCounter].length; optCounter++)
				{
					if(document.forms[0].elements[nCounter].options[optCounter].selected)
					{
						if (trimTheString(defVal) != "")
						{
							defVal = defVal + ", " + document.forms[0].elements[nCounter].options[optCounter].text;
							defCodeValue = defCodeValue + ", " + document.forms[0].elements[nCounter].options[optCounter].value
						}
						else
						{
							defVal = document.forms[0].elements[nCounter].options[optCounter].text;
							defCodeValue = document.forms[0].elements[nCounter].options[optCounter].value
						}
					}
				}
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (defVal != valueArray[nCounter])
						{
							if (enameVal)
							{
								ctr++;
								if (trimTheString(valueArray[nCounter])=="")
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + defVal + "</b>";
								}
								else
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + defVal + "</b>";
								}
								XMLValue = defVal;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

								XMLValue = defCodeValue
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
							}
						}
					}
				}
				else
				{
					if (defVal != valueArray[nCounter])
					{
						if (enameVal)
						{
							ctr++;
							if (trimTheString(valueArray[nCounter])=="")
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + defVal + "</b>";
							}
							else
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + defVal + "</b>";
							}
							XMLValue = defVal;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLValue = defCodeValue
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
				}
				defVal = "";
			}
			else if (szElementType == "radio")
			{
				for (arrCounter=0; arrCounter<nameArray.length; arrCounter++)
				{
					if (document.forms[0].elements[nCounter].name == nameArray[arrCounter])
					{
						break;
					}
				}
				if (nameArray[arrCounter])
				{
					radtemp = "1";
					defDesc = document.forms[0].elements[arrCounter].desc;
				}
				else
				{
					radtemp = "0";
				}
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (document.forms[0].elements[nCounter].value != valueArray[arrCounter] && document.forms[0].elements[nCounter].checked && radtemp == "1")
						{
							if (enameVal)
							{
								ctr++;
								if (trimTheString(defDesc)=="")
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + document.forms[0].elements[nCounter].desc + "</b>";
								}
								else
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + defDesc + "</b> To: <b>" + document.forms[0].elements[nCounter].desc + "</b>";
								}
								XMLValue = document.forms[0].elements[nCounter].desc;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "
								
								XMLValue = document.forms[0].elements[nCounter].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
							}
						}
						else if ( radtemp == "0")
						{
							if (document.forms[0].elements[nCounter].checked && enameVal)
							{
								ctr++;
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + ": <b>" + document.forms[0].elements[nCounter].desc + "</b>";
								XMLValue = document.forms[0].elements[nCounter].desc;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

								XMLValue = document.forms[0].elements[nCounter].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
							}
						}
					}
				}
				else
				{
					if (document.forms[0].elements[nCounter].value != valueArray[arrCounter] && document.forms[0].elements[nCounter].checked && radtemp == "1")
					{
						if (enameVal)
						{
							ctr++;
							if (trimTheString(defDesc)=="")
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + document.forms[0].elements[nCounter].desc + "</b>";
							}
							else
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + defDesc + "</b> To: <b>" + document.forms[0].elements[nCounter].desc + "</b>";
							}
							XMLValue = document.forms[0].elements[nCounter].desc;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLValue = document.forms[0].elements[nCounter].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
					else if ( radtemp == "0")
					{
						if (document.forms[0].elements[nCounter].checked && enameVal)
						{
							ctr++;
							endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + ": <b>" + document.forms[0].elements[nCounter].desc + "</b>";
							XMLValue = document.forms[0].elements[nCounter].desc;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLValue = document.forms[0].elements[nCounter].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
				}
			}
			else if (szElementType == "checkbox")
			{
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (new String(document.forms[0].elements[nCounter].checked) != valueArray[nCounter])
						{
							if (document.forms[0].elements[nCounter].checked)
							{
								szfrom = "Unchecked";
								szto = "Checked";
							}
							else
							{
								szfrom = "Checked";
								szto = "Unchecked";
							}
							if (enameVal)
							{
								ctr++;
								if (trimTheString(szfrom)=="")
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + szto + "</b>";
								}
								else
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + szfrom + "</b> To: <b>" + szto + "</b>";
								}
								XMLValue = szto;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "

								XMLValue = document.forms[0].elements[nCounter].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "'  "
							}
						}
					}
				}
				else
				{
					if (new String(document.forms[0].elements[nCounter].checked) != valueArray[nCounter])
					{
						if (document.forms[0].elements[nCounter].checked)
						{
							szfrom = "Unchecked";
							szto = "Checked";
						}
						else
						{
							szfrom = "Checked";
							szto = "Unchecked";
						}
						if (enameVal)
						{
							ctr++;
							if (trimTheString(szfrom)=="")
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + szto + "</b>";
							}
							else
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + szfrom + "</b> To: <b>" + szto + "</b>";
							}
							XMLValue = szto;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
						}
					}
				}
			}
			else
			{
				if (sp)
				{
					if(eval(sp).style.display != "none")
					{
						if (document.forms[0].elements[nCounter].value != valueArray[nCounter])
						{
							if (enameVal)
							{
								ctr++;
								if (trimTheString(valueArray[nCounter])=="")
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + document.forms[0].elements[nCounter].value + "</b>";
								}
								else
								{
									endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + document.forms[0].elements[nCounter].value + "</b>";
								}
								XMLValue = document.forms[0].elements[nCounter].value;
									XMLValue = FormatXMLString(XMLValue)
								XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
							}
						}
					}
				}
				else
				{
					if (document.forms[0].elements[nCounter].value != valueArray[nCounter])
					{
						if (enameVal)
						{
							ctr++;
							if (trimTheString(valueArray[nCounter])=="")
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - <b>" + document.forms[0].elements[nCounter].value + "</b>";
							}
							else
							{
								endorsementText = endorsementText + "\n" + ctr + ") " + document.forms[0].elements[nCounter].ename + " - From: <b>" + valueArray[nCounter] + "</b> To: <b>" + document.forms[0].elements[nCounter].value + "</b>";
							}
							XMLValue = document.forms[0].elements[nCounter].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
						}
					}
				}
			}
		}
	}
	
	if (trimTheString(XMLAttribs) != "" && document.forms[0].txtXMLNodeName && document.forms[0].txtXMLEndorsement)
	{
		XMLNodeName	= document.forms[0].txtXMLNodeName.value;
		XMLAttribs = "<" + XMLNodeName + " PrimaryParams='' id1='' " + XMLAttribs + "/>"
		document.forms[0].txtXMLEndorsement.value = XMLAttribs;
	}
	if (document.forms[0].hidTag)
		{
		rep = document.forms[0].hidTag.value;
		szTag = szTag.replace("@substituteinfo",rep);
	}
	if (trimTheString(endorsementText) != "")
	{
		endorsementText = szTag + " :\n" + endorsementText;
		document.forms[0].txtEndorsements.value = endorsementText;
	}
	//alert(document.forms[0].txtEndorsements.value);
}



//END OF FINDCHANGEMERGE FUNCTION

function getSaveValues(szTag,AllTag)
{
	var nItemCount, szElementType;
	var defVal = "", endorsementText = "", valuesList;
	var defDesc;
	var enameVal, istag;
	var FinalXMLString, XMLAttribs, XMLTag, XMLValue, XMLNodeName
	XMLAttribs = '';
	XMLTag = "";
	XMLValue = "";


	nItemCount = document.forms[0].elements.length;
	for(var nCounter=0; nCounter<nItemCount; nCounter++)
	{
		enameVal = document.forms[0].elements[nCounter].ename;
		XMLTag = enameVal;

		if (XMLTag != null )
		{
			XMLTag = ReplaceString(XMLTag, " ", "_")
			XMLTag = XMLTag.toUpperCase();
		}

		if (AllTag)
		{
			istag = document.forms[0].elements[nCounter].tag;
		}
		else
		{
			istag = 1;
		}
		szElementType = document.forms[0].elements[nCounter].type;
		//defName = document.forms[0].elements[nCounter].name;
		if (trimTheString(enameVal) != "")
		{
			if (szElementType == "select-one")
			{
				if (document.forms[0].elements[nCounter].length == 1)
				{
					defVal = document.forms[0].elements[nCounter].options[0].text;
				}
				else
				{
					for(var optCounter=0; optCounter<document.forms[0].elements[nCounter].length; optCounter++)
					{
						if(document.forms[0].elements[nCounter].options[optCounter].selected)
						{
							defVal = document.forms[0].elements[nCounter].options[optCounter].text;
							break;
						}
					}
				}
				if (defVal != "")
				{
					if (enameVal && istag)
					{
						endorsementText = endorsementText + "\n" + document.forms[0].elements[nCounter].ename + " : " + defVal;
						XMLValue = defVal
							XMLValue = FormatXMLString(XMLValue)
						XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
	
						XMLValue = document.forms[0].elements[nCounter].value;
							XMLValue = FormatXMLString(XMLValue)
						XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
					}
				}
				defVal = "";
			}
			else if (szElementType == "select-multiple")
			{
				if (document.forms[0].elements[nCounter].length == 1)
				{
					defVal = document.forms[0].elements[nCounter].options[0].text;
				}
				else
				{
					for(var optCounter=0; optCounter<document.forms[0].elements[nCounter].length; optCounter++)
					{
						if(document.forms[0].elements[nCounter].options[optCounter].selected)
						{
							if (defVal != "")
							{
								defVal = defVal + ", " + document.forms[0].elements[nCounter].options[optCounter].text;
								valuesList = valuesList + ", " + document.forms[0].elements[nCounter].options[optCounter].value;
							}
							else
							{
								valuesList = document.forms[0].elements[nCounter].options[optCounter].value;
							}
						}
					}
				}
				if (defVal != "")
				{
					if (enameVal && istag)
					{
						endorsementText = endorsementText + "\n" + document.forms[0].elements[nCounter].ename + " : " + defVal;
						XMLValue = defVal
							XMLValue = FormatXMLString(XMLValue)
						XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "

						XMLValue = valuesList;
							XMLValue = FormatXMLString(XMLValue)
						XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
					}
				}
				defVal = "";
			}
			else if (szElementType == "radio")
			{
				if (document.forms[0].elements[nCounter].checked)
				{
					defDesc = document.forms[0].elements[nCounter].desc;
					if (defDesc != "")
					{
						if (enameVal && istag)
						{
							endorsementText = endorsementText + "\n" + document.forms[0].elements[nCounter].ename + " : " + defDesc;
							XMLValue = defDesc
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "

							XMLValue = document.forms[0].elements[nCounter].value;
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
						}
					}
				}
			}
			else if (szElementType == "checkbox")
			{
				if (document.forms[0].elements[nCounter].checked)
				{
					if (enameVal && istag)
					{
						endorsementText = endorsementText + "\n" + document.forms[0].elements[nCounter].ename + " : Checked";
						XMLValue = "Checked"
							XMLValue = FormatXMLString(XMLValue)
						XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "

						XMLValue = document.forms[0].elements[nCounter].value;
							XMLValue = FormatXMLString(XMLValue)
						XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
					}
				}
				else
				{
					if (enameVal && istag)
					{
						endorsementText = endorsementText + "\n" + document.forms[0].elements[nCounter].ename + " : UnChecked";
						XMLValue = "UnChecked"
							XMLValue = FormatXMLString(XMLValue)
						XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "

						XMLValue = document.forms[0].elements[nCounter].value;
							XMLValue = FormatXMLString(XMLValue)
						XMLAttribs = XMLAttribs + XMLTag + "_CODE='" + XMLValue + "' "
					}
				}
			}
			else if (szElementType == "text" || szElementType == "textarea" || szElementType == "hidden" ) 
			{
				if (document.forms[0].elements[nCounter].value != "")
				{
					{
						if (enameVal && istag)
						{
							endorsementText = endorsementText + "\n" + document.forms[0].elements[nCounter].ename + " : " + document.forms[0].elements[nCounter].value;
							XMLValue = document.forms[0].elements[nCounter].value
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
						}
					}
				}
			}
		}
	}

	if (trimTheString(XMLAttribs) != "" && document.forms[0].txtXMLNodeName && document.forms[0].txtXMLEndorsement)
	{
		XMLNodeName	= document.forms[0].txtXMLNodeName.value;
		XMLAttribs = "<" + XMLNodeName + " PrimaryParams='' id1='' " + XMLAttribs + "/>"
		document.forms[0].txtXMLEndorsement.value = XMLAttribs;
	}
	if (endorsementText != "")
	{
		endorsementText = szTag + ":\n" + endorsementText;
		document.forms[0].txtEndorsements.value = endorsementText;
	}
//alert(endorsementText);
}

function FormatXMLString(lstrXMLString)
{
	lstrXMLString = ReplaceString(lstrXMLString, "&", "&amp;");
	lstrXMLString = ReplaceString(lstrXMLString, "<", "&lt;");
	lstrXMLString = ReplaceString(lstrXMLString, ">", "&gt;");
	lstrXMLString = ReplaceString(lstrXMLString, '"', '&quot;');
	lstrXMLString = ReplaceString(lstrXMLString, "'", "&apos;");
	return lstrXMLString;
}
//Function ReplaceString
//By Shashidhar Rao. L
// Purpose : it will replace a charecter in a string with the given charecter
function ReplaceString(lstrString, lcharReplaceChar, lstrReplaceWith)
{
	if (lstrString == "" || lstrString == null)
	{
		return ""
	}
	else
	{
		var lintcounter, lintcurrLoc, retText, lintStringLength
		retText = ""
		for (lintcounter =0 ; lintcounter < lstrString.length; lintcounter++)
			if (lstrString.charAt(lintcounter) == lcharReplaceChar)
				retText = retText + lstrReplaceWith;
			else
				retText = retText + lstrString.charAt(lintcounter)
		return retText;
	}
}

function ReplaceAllDangerChars(lstrSourceString)
{
	if (lstrSourceString == "" || lstrSourceString == null)
		return ""
	else
	{
		var ReplacedString
		ReplacedString = ReplaceString(lstrSourceString, "'", "\'");
		ReplacedString = ReplaceString(ReplacedString, '"', '\"');
		return ReplacedString;
	}
}

// Function StripDash
// Added by Piyush
// Date added 05 Dec 2000
// Last modified 05 Dec 2000
// Purpose	This function will return the string with dashes removed

function StripDash(szSSNNo)
{
	var szStrippedSSN;
	var intCount;
	szStrippedSSN = "";
	var arrSSN;
	if (trimTheString(szSSNNo) != "")
	{
		arrSSN = szSSNNo.split("-");
		for(intCount = 0; intCount<arrSSN.length; intCount++)
		{
			szStrippedSSN = szStrippedSSN + arrSSN[intCount];
		}
	}
	return(szStrippedSSN);
}


// Fucntion FormatSSN
// Added by Piyush
// Date added 05 Dec 2000
// Last modified 05 Dec 2000
// Input SSN#, FormName, FieldName
// Purpose	To format the SSN # entered into actual SSN format

function FormatSSN(szSSNNo,szFormName,szFieldName)
{
	var arrSSN;
	var intCount;
	var szStrippedSSN;
	var FieldToStore;
	if (trimTheString(szSSNNo) != "")
	{
		szStrippedSSN = StripDash(szSSNNo);
		FirstPart = szStrippedSSN.substr(0,3)
		SecondPart = szStrippedSSN.substr(3,2)
		ThirdPart = szStrippedSSN.substr(5,4)
		FullSSN = FirstPart + "-" + SecondPart + "-" + ThirdPart;
		eval('document.'+szFormName+'.'+szFieldName).value=FullSSN;
	}
}


// Function FormatPhone
// Added by Piyush
// Date added 05 Dec 2000
// Last modified 05 Dec 2000
// Last modified 27 Sept 2001
// To validate alphabetic characters
// updated by Chetan H
// Last modified 31 Oct 2001
// To validate the length not to be greater than 10 digits.
// updated by Chetan H
// Input Tel#, FormName, FieldName
var flagChkBlur = 0;
var szTempFieldName;
/*function FormatPhone(szPhoneNo,szFormName,szFieldName,szFormatOrNot)
{
	var arrSSN;
	var intCount;
	var szStrippedPhone;
	var FieldToStore;
	var strLength;

	//Added by Balaji. V
	var strCharAtPos
	var strStrpPhoneNo;
	
	var boolAreaCodeValidation;
	
	szPhoneNo = trimTheString(szPhoneNo)
	strLength = szPhoneNo.length;
	boolAreaCodeValidation = false;
	strCharAtPos = "";
	if (szPhoneNo != "")
	{
		if (strLength == 5)
		{
			for (ctr=0; ctr<=strLength-1; ctr++)
			{				
				strCharAtPos = strCharAtPos + szPhoneNo.charAt(ctr);
				if (ctr==0)
				{
					if (strCharAtPos != "(")
					{
						boolAreaCodeValidation = false;
						break;
					}
				}
				else if	(ctr==5)
				{
					if (strCharAtPos !=	")")
					{
						boolAreaCodeValidation = false;
						break;
					}
				}
				else
					boolAreaCodeValidation = true;
			}
			if (boolAreaCodeValidation == true)
			{
				szCheckForInt = strCharAtPos.substring(1,4)
				if (isNaN(szCheckForInt) == true)
				{
					boolAreaCodeValidation = false;
				}
				else
					boolAreaCodeValidation = true;
			}
			if (boolAreaCodeValidation == false)
			{
				alert("Invalid Area Code");
				eval('document.'+szFormName+'.'+szFieldName).focus();
				return;
			}
			//End of Addition
		}
		else
		{
			boolAreaCodeValidation = false;
		}
	}
	else
	{
		boolAreaCodeValidation = true;
	}
	if (boolAreaCodeValidation == false)
	{
		strCharAtPos = "";
		flagChkBlur = 0;
		if (flagChkBlur == 0)
		{
			szTempFieldName = szFieldName;
		}

		if (flagChkBlur == 1)
		{
			if(szTempFieldName == szFieldName)
			{
				flagChkBlur = 0;
			}
		}
		if(trimTheString(szPhoneNo) != "")
		{
			if (szFormatOrNot != "")
			{
				szPhoneNo = trimTheString(szPhoneNo)
				strLength = szPhoneNo.length;
				strStrpPhoneNo = "";
				for (ctr=1; ctr <= strLength ; ctr++)
				{
					strCharAtPos = szPhoneNo.charAt(ctr-1)
					if(!((strCharAtPos=="(") || (strCharAtPos==")") || (strCharAtPos==" ") || (strCharAtPos=="-")))
					{
						strStrpPhoneNo = strStrpPhoneNo + strCharAtPos
					}
				}
				szPhoneNo = strStrpPhoneNo
				szPhoneLen = StripDashAndBracket(szPhoneNo)

				//if (strLength > 7)
				//{
					szStrippedPhone = StripDash(szPhoneNo);
				if(flagChkBlur == 0)
				{	
					if((szPhoneLen.length > 10 || szPhoneLen.length < 10))
					{
						alert("The Phone Number must be 10 digits.")
						eval('document.'+szFormName+'.'+szFieldName).focus();
						flagChkBlur = 1;
					}
					else
					{
						var FirstPart = szStrippedPhone.substr(0,3)
						var SecondPart = szStrippedPhone.substr(3,3)
						var ThirdPart = szStrippedPhone.substr(6,4)
						if (!(isNaN(FirstPart) || isNaN(SecondPart) || isNaN(ThirdPart)))
						{	
							FullPhone = "(" + FirstPart + ")" + SecondPart + "-" + ThirdPart;
							eval('document.'+szFormName+'.'+szFieldName).value=FullPhone;
						}
						else
						{
							alert("Please Enter a numeric value")
							eval('document.'+szFormName+'.'+szFieldName).focus();
						}
					}
				}
			}
			else
			{
		//		eval('document.'+szFormName+'.'+szFieldName).value=szPhoneNo;
				szPhoneLen = StripDashAndBracket(szPhoneNo)
				if(flagChkBlur == 0 && (szPhoneLen.length > 10 || szPhoneLen.length < 10))
				{		
					alert("The Phone Number must be 10 digits.")
					eval('document.'+szFormName+'.'+szFieldName).focus();
					flagChkBlur = 1;
				}
				else
				{
					if(!(isNaN(StripDashAndBracket(szPhoneNo))))
					{
						eval('document.'+szFormName+'.'+szFieldName).value=szPhoneNo;
					}
					else
					{
						alert("Please Enter a numeric value")
						eval('document.'+szFormName+'.'+szFieldName).focus();
					}		
				}
			}
		}
	}
}*/


// Function StripDashAndBracket
// Added by Chetan 
// Date added 27 Sep 2001
// Input variable to be formated
// Purpose	To format the phone number field to remove dash and brackets and used within the function
function StripDashAndBracket(szSSNNo)
{
	var szStrippedSSN;
	var intCount;
	szStrippedSSN = "";
	var arrSSN;
	if (szSSNNo != "")
	{
		arrSSN = szSSNNo.split("-");
		for(intCount = 0; intCount < arrSSN.length; intCount++)
		{
			szStrippedSSN = szStrippedSSN + arrSSN[intCount];
		}
		arrSSN1 = szStrippedSSN.split("(");
		szStrippedSSN = "";
		for(intCount = 0; intCount < arrSSN1.length; intCount++)
		{
			szStrippedSSN = szStrippedSSN + arrSSN1[intCount];

		}
		arrSSN2 = szStrippedSSN.split(")");
		szStrippedSSN = "";
		for(intCount = 0; intCount < arrSSN2.length; intCount++)
		{
			szStrippedSSN = szStrippedSSN + arrSSN2[intCount];
		}
	}
	return(szStrippedSSN);
}

function GridDefaultValues(hidFieldName,mainFieldName,allFieldName,maxRows)
{
	var szElementType, szAllFieldNameArray, szElementName;
	var defVal = "";
	var szAdd = "", szUpdate = "";
	var ctr = 0;
	szAllFieldNameArray = allFieldName.split(",");
	for (ctr=1; ctr <= maxRows ; ctr++)
	{
		if (eval('document.forms[0].' + hidFieldName + ctr + '.value')>0)
		{
			for (var nctr=0; nctr<szAllFieldNameArray.length; nctr++)
			{
				if (szAllFieldNameArray[nctr] == mainFieldName)
				{
					szElementName = szAllFieldNameArray[nctr] + ctr + '_Desc';
				}
				else
				{
					szElementName = szAllFieldNameArray[nctr] + ctr;
				}
				szElementType = eval('document.forms[0].'+szElementName+'.type');
				if (szElementType != "hidden")
				{
					if (szElementType == "select-one")
					{
						defVal = eval('document.forms[0].'+szElementName+'[document.forms[0].'+szElementName+'.selectedIndex].text');
						szUpdate = szUpdate + defVal + "~";
						defVal = "";
					}
					else if (szElementType == "select-multiple")
					{
						for(var optCounter=0; optCounter<eval('document.forms[0].'+szElementName+'.length'); optCounter++)
						{
							if(eval('document.forms[0].'+szElementName+'.options['+optCounter+'].selected'))
							{
								if (trimTheString(defVal) != "")
								{
									defVal = defVal + ", " + document.forms[0].elements[nCounter].options[optCounter].text;
								}
								else
								{
									defVal = document.forms[0].elements[nCounter].options[optCounter].text;
								}
							}
						}
						szUpdate = szUpdate + defVal + "~";
						defVal ="";
					}
					else if (szElementType == "radio")
					{
					}
					else if (szElementType == "checkbox")
					{
					}
					else
					{
						szUpdate = szUpdate + eval('document.forms[0].'+szElementName+'.value') + "~" ;
					}
				}
			}
		}
	}
	document.forms[0].hidUpdate.value = szUpdate;
	szUpdate = "";
}

function GridSaveValues(szTag,hidFieldName,mainFieldName,allFieldName,maxRows)
{
	var szElementType, szAllFieldNameArray, szElementName;
	var defVal = "", szFinal = new Array();
	var szAdd = "", szUpdate = "", szTitle = "";
	var FinalXMLString, XMLAttribs, XMLNodeName, XMLAllAttribs, XMLTag, valueOfDesc="";
	var ctr = 0, colnum = 0, i=0;
	szAllFieldNameArray = allFieldName.split(",");

	XMLNodeName = "";
	FinalXMLString = "";
	XMLAttribs = "";
	XMLTitle = "";
	XMLAllAttribs = "";

	if (document.forms[0].txtXMLNodeName)
		XMLNodeName	= document.forms[0].txtXMLNodeName.value;
	for (ctr=1; ctr <= maxRows ; ctr++)
	{
		XMLAttribs = ""

		if (eval('document.forms[0].' + hidFieldName + ctr + '.value')=="-1")
		{
			XMLAttribs = " PrimaryParams='' id1='' id2='" + eval('document.forms[0].' + hidFieldName + ctr + '.value') + "' ADDCHANGEDELETE='A' ISDEPENDENCY='N' "
			for (var nctr=0; nctr<szAllFieldNameArray.length; nctr++)
			{
				if (szAllFieldNameArray[nctr] == mainFieldName)
				{
					if(eval('document.forms[0].'+ szAllFieldNameArray[nctr] + ctr))
					{
						XMLTag = "COVERAGE_CODE"
						XMLValue = eval('document.forms[0].'+ szAllFieldNameArray[nctr] + ctr +'.value')

						if (XMLValue != null )
							XMLValue = FormatXMLString(XMLValue)

						XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "
					}
					szElementName = szAllFieldNameArray[nctr] + ctr + '_Desc';
					if (eval('document.forms[0].'+szElementName+'.value')=="")
					{
						XMLAttribs = ""
						break;
					}
				}
				else
				{
					szElementName = szAllFieldNameArray[nctr] + ctr;
				}
				szElementType = eval('document.forms[0].'+szElementName+'.type');
				if (szElementType != "hidden")
				{
					if (szElementType == "select-one")
					{
						defVal = eval('document.forms[0].'+szElementName+'[document.forms[0].'+szElementName+'.selectedIndex].text');
						valueOfDesc = eval('document.forms[0].'+szElementName+'[document.forms[0].'+szElementName+'.selectedIndex].value');
						if (defVal != "")
						{
							szAdd = szAdd + eval('document.forms[0].'+szElementName+'.ename')+ " : " + defVal + "\n";

							XMLTag = eval('document.forms[0].'+szElementName+'.ename')
							XMLValue = defVal

							if (XMLTag != null )
							{
								XMLTag = ReplaceString(XMLTag, " ", "_")
								XMLTag = XMLTag.toUpperCase();
							}
							if (XMLValue != null )
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLTag = XMLTag + "_CODE"
							XMLValue = valueOfDesc
							if (XMLValue != null )
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							defVal = "";
							valueOfDesc = "";
						}
					}
					else if (szElementType == "select-multiple")
					{
						for(var optCounter=0; optCounter<eval('document.forms[0].'+szElementName+'.length'); optCounter++)
						{
							if(eval('document.forms[0].'+szElementName+'.options['+optCounter+'].selected'))
							{
								if (trimTheString(defVal) != "")
								{
									defVal = defVal + ", " + document.forms[0].elements[nCounter].options[optCounter].text;
								}
								else
								{
									defVal = document.forms[0].elements[nCounter].options[optCounter].text;
								}
							}
						}
						if (defVal != "")
						{
							szAdd = szAdd + eval('document.forms[0].'+szElementName+'.ename')+ " : " + defVal + "\n";

							XMLTag = eval('document.forms[0].'+szElementName+'.ename')
							XMLValue = defVal

							if (XMLTag != null )
							{
								XMLTag = ReplaceString(XMLTag, " ", "_")
								XMLTag = XMLTag.toUpperCase();
							}
							if (XMLValue != null )
								XMLValue = FormatXMLString(XMLValue)

							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							defVal = "";
						}
					}
					else if (szElementType == "radio")
					{
					}
					else if (szElementType == "checkbox")
					{
					}
					else
					{
						defVal = eval('document.forms[0].'+szElementName+'.value');
						if (defVal != "")
						{
							szAdd = szAdd + eval('document.forms[0].'+szElementName+'.ename')+ " : " + defVal + "\n";

							XMLTag = eval('document.forms[0].'+szElementName+'.ename')
							XMLValue = defVal

							if (XMLTag != null )
							{
								XMLTag = ReplaceString(XMLTag, " ", "_")
								XMLTag = XMLTag.toUpperCase();
							}
							if (XMLValue != null )
								XMLValue = FormatXMLString(XMLValue)

							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							defVal = "";
						}
					}
					colnum++;
				}
				if (colnum == szAllFieldNameArray.length)
				{
					if (szAdd != "")
					{
						szFinal[i] = "\n" + eval(i + 1) + ":\n";
						szFinal[i] = szFinal[i] + szAdd;
						XMLAttribs = "<" + XMLNodeName + " " + XMLAttribs + " />" ;
					}
					else
					{
						szFinal[i] = "";
						XMLAttribs = ""
					}
					szAdd = "";
					i++;
					colnum = 0;
				}
			}
			if (trimTheString(XMLAttribs) != "" )
				XMLAllAttribs = XMLAllAttribs + "\n " + XMLAttribs 
		}
	}
	for (i=0; i<szFinal.length;i++)
	{
		szAdd = szAdd + szFinal[i];
	}
	if (szAdd != "")
	{
		document.forms[0].hidAdd.value = szTag + "\n" + szAdd;
	}
	else
	{
		document.forms[0].hidAdd.value = "";
	}
	if (document.forms[0].txtXMLAddedEndorsement)
		document.forms[0].txtXMLAddedEndorsement.value = XMLAllAttribs;
	szAdd = "";
}

function GetDeletionDetail(szTag,hidFieldName,mainFieldName,allFieldName,maxRows)
{
	var szElementType, szAllFieldNameArray, szElementName;
	var defVal = "", szFinal = new Array();
	var szAdd = "", szUpdate = "", szTitle = "";
	var ctr = 0, colnum = 0, i=0, nItemCount = 0;
	szAllFieldNameArray = allFieldName.split(",");

	nItemCount = document.forms[0].elements.length;
	for(var nCounter=0; nCounter<nItemCount; nCounter++)
	{
		szElementType = document.forms[0].elements[nCounter].type;
		if (szElementType == "radio")
		{
			if (document.forms[0].elements[nCounter].checked)
			{
				defVal = document.forms[0].elements[nCounter].value;
			}
		}
	}
	if (szElementType != "hidden")
	for (ctr=1; ctr <= maxRows ; ctr++)
	{
		if (eval('document.forms[0].' + hidFieldName + ctr + '.value')=="-1")
		{
			for (var nctr=0; nctr<szAllFieldNameArray.length; nctr++)
			{
				if (szAllFieldNameArray[nctr] == mainFieldName)
				{
					szElementName = szAllFieldNameArray[nctr] + ctr + '_Desc';
					if (eval('document.forms[0].'+szElementName+'.value')=="")
					{
						break;
					}
				}
				else
				{
					szElementName = szAllFieldNameArray[nctr] + ctr;
				}
				szElementType = eval('document.forms[0].'+szElementName+'.type');
				if (szElementType != "hidden")
				{
					if (szElementType == "select-one")
					{
						defVal = eval('document.forms[0].'+szElementName+'[document.forms[0].'+szElementName+'.selectedIndex].text');
						if (defVal != "")
						{
							szAdd = szAdd + eval('document.forms[0].'+szElementName+'.ename')+ " : " + defVal + "\n";
							defVal = "";
						}
					}
					else if (szElementType == "select-multiple")
					{
						for(var optCounter=0; optCounter<eval('document.forms[0].'+szElementName+'.length'); optCounter++)
						{
							if(eval('document.forms[0].'+szElementName+'.options['+optCounter+'].selected'))
							{
								if (trimTheString(defVal) != "")
								{
									defVal = defVal + ", " + document.forms[0].elements[nCounter].options[optCounter].text;
								}
								else
								{
									defVal = document.forms[0].elements[nCounter].options[optCounter].text;
								}
							}
						}
						if (defVal != "")
						{
							szAdd = szAdd + eval('document.forms[0].'+szElementName+'.ename')+ " : " + defVal + "\n";
							defVal = "";
						}
					}
					else if (szElementType == "radio")
					{
					}
					else if (szElementType == "checkbox")
					{
					}
					else
					{
						defVal = eval('document.forms[0].'+szElementName+'.value');
						if (defVal != "")
						{
							szAdd = szAdd + eval('document.forms[0].'+szElementName+'.ename')+ " : " + defVal + "\n";
							defVal = "";
						}
					}
					colnum++;
				}
				if (colnum == szAllFieldNameArray.length)
				{
					if (szAdd != "")
					{
						szFinal[i] = "\n " + eval(i + 1) + ":\n";
						szFinal[i] = szFinal[i] + szAdd;
					}
					else
					{
						szFinal[i] = "";
					}
					szAdd = "";
					i++;
					colnum = 0;
				}
			}
		}
	}
	for (i=0; i<szFinal.length;i++)
	{
		szAdd = szAdd + szFinal[i] + "\n"
	}
	if (szAdd != "")
	{
		document.forms[0].hidAdd.value = szTag + "\n" + szAdd;
	}
	else
	{
		document.forms[0].hidAdd.value = "";
	}
	szAdd = "";
}

function GridFindChanges(szTag,hidFieldName,mainFieldName,allFieldName,maxRows)
{
	var szElementType, szAllFieldNameArray, szElementName,szValues;
	var defVal = "", colnum = 0, ename="", valueOfDesc="";
	var szAdd = "", szUpdate = "", szTitle = "", szFinal = new Array();
	var FinalXMLString, XMLAttribs, XMLNodeName, XMLAllAttribs, XMLTag
	XMLNodeName = "";
	FinalXMLString = "";
	XMLAttribs = "";
	XMLTitle = "";
	XMLAllAttribs = "";
	
	var ctr = 0 , aptr = 0 , sctr = 0, i = 0;
	szAllFieldNameArray = allFieldName.split(",");
	szValues = document.forms[0].hidUpdate.value;
	szValues =  szValues.split("~");
	document.forms[0].txtEndorsements.value = "";
	if (document.forms[0].txtXMLNodeName)
		XMLNodeName	= document.forms[0].txtXMLNodeName.value;
	for (ctr=1; ctr <= maxRows ; ctr++)
	{
		XMLAttribs = ""

		if (eval('document.forms[0].' + hidFieldName + ctr + '.value')>0)
		{
			XMLAttribs = " PrimaryParams='' id1='' id2='" + eval('document.forms[0].' + hidFieldName + ctr + '.value') + "' ADDCHANGEDELETE='C' ISDEPENDENCY='N' "

			for (var nctr=0; nctr<szAllFieldNameArray.length; nctr++)
			{
				if (szAllFieldNameArray[nctr] == mainFieldName)
				{
					szElementName = szAllFieldNameArray[nctr] + ctr + '_Desc';

					if (eval('document.forms[0].'+ szAllFieldNameArray[nctr] + ctr))
					{
						XMLTag = "Coverage Code"
						XMLValue = eval('document.forms[0].'+ szAllFieldNameArray[nctr] + ctr +'.value')

						if (XMLTag != null )
						{
							XMLTag = ReplaceString(XMLTag, " ", "_")
							XMLTag = XMLTag.toUpperCase();
						}
						if (XMLValue != null )
							XMLValue = FormatXMLString(XMLValue)

						XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "'  "
					}
				}
				else
				{
					szElementName = szAllFieldNameArray[nctr] + ctr;
				}
				szElementType = eval('document.forms[0].'+szElementName+'.type');
				if (szElementType != "hidden")
				{
					if (szTitle != "")
					{
						if (szValues[aptr] != "")
						{
							szTitle = szTitle + ", " + eval('document.forms[0].'+szElementName+'.ename') + ": " + szValues[aptr];
						}
					}
					else
					{
						szTitle = szTitle + eval('document.forms[0].'+szElementName+'.ename') + ": " + szValues[aptr];
					}
					if (szElementType == "select-one")
					{
						defVal = eval('document.forms[0].'+szElementName+'[document.forms[0].'+szElementName+'.selectedIndex].text');
						valueOfDesc = eval('document.forms[0].'+szElementName+'[document.forms[0].'+szElementName+'.selectedIndex].value');
						if ( szValues[aptr] != defVal)
						{
							sctr++;
							szUpdate = szUpdate + "\n" + sctr + ") " + eval('document.forms[0].'+szElementName+'.ename') + " - From: <b>" +  szValues[aptr]+ "</b> To: <b>" + defVal + "</b>";
							XMLTag = eval('document.forms[0].'+szElementName+'.ename')
							XMLValue = defVal

							if (XMLTag != null )
							{
								XMLTag = ReplaceString(XMLTag, " ", "_")
								XMLTag = XMLTag.toUpperCase();
							}
							if (XMLValue != null )
								XMLValue = FormatXMLString(XMLValue)
							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "

							XMLTag = XMLTag + "_CODE"
							XMLValue = valueOfDesc

							if (XMLValue != null )
								XMLValue = FormatXMLString(XMLValue)

							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "
						}
						defVal = "";
						valueOfDesc = "";
					}
					else if (szElementType == "select-multiple")
					{
						for(var optCounter=0; optCounter<eval('document.forms[0].'+szElementName+'.length'); optCounter++)
						{
							if(eval('document.forms[0].'+szElementName+'.options['+optCounter+'].selected'))
							{
								if (trimTheString(defVal) != "")
								{
									defVal = defVal + ", " + document.forms[0].elements[nCounter].options[optCounter].text;
								}
								else
								{
									defVal = document.forms[0].elements[nCounter].options[optCounter].text;
								}
							}
						}
						if ( szValues[aptr] != defVal)
						{
							sctr++;
							szUpdate = szUpdate + "\n" + sctr + ") " + eval('document.forms[0].'+szElementName+'.ename') + " - From: <b>" +  szValues[aptr]+ "</b> To: <b>" + defVal + "</b>";
							XMLTag = eval('document.forms[0].'+szElementName+'.ename')
							XMLValue = defVal

							if (XMLTag != null )
							{
								XMLTag = ReplaceString(XMLTag, " ", "_")
								XMLTag = XMLTag.toUpperCase();
							}
							if (XMLValue != null )
								XMLValue = FormatXMLString(XMLValue)

							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "
						}
						defVal ="";
					}
					else if (szElementType == "radio")
					{
					}
					else if (szElementType == "checkbox")
					{
					}
					else
					{
						if ( szValues[aptr] != eval('document.forms[0].'+szElementName+'.value'))
						{
							sctr++;
							szUpdate = szUpdate + "\n" + sctr + ") " + eval('document.forms[0].'+szElementName+'.ename') + " - From: <b>" +  szValues[aptr]+ "</b> To: <b>" + eval('document.forms[0].'+szElementName+'.value') + "</b>";

							XMLTag = eval('document.forms[0].'+szElementName+'.ename')
							XMLValue = eval('document.forms[0].'+szElementName+'.value')

							if (XMLTag != null )
							{
								XMLTag = ReplaceString(XMLTag, " ", "_")
								XMLTag = XMLTag.toUpperCase();
							}
							if (XMLValue != null )
								XMLValue = FormatXMLString(XMLValue)

							XMLAttribs = XMLAttribs + XMLTag + "='" + XMLValue + "' "
						}
					}
					aptr++;
					colnum++;
				}
				if (colnum == szAllFieldNameArray.length)
				{
					if (szTitle != "" && szUpdate != "")
					{
						szFinal[i] = szTag + " (" + szTitle + ") has been updated: ";
						szFinal[i] = szFinal[i] + szUpdate + "\n";
						XMLAttribs = "<" + XMLNodeName + " " + XMLAttribs + " />\n" ;
					}
					else
					{
						szFinal[i] = "";
						XMLAttribs = ""
					}

					szUpdate = "";
					szTitle = "";
					i++;
					sctr = 0;
					colnum = 0;
				}
			}
			if (trimTheString(XMLAttribs) != "" )
				XMLAllAttribs = XMLAllAttribs + " " + XMLAttribs
		}
	}
	for (i=0; i<szFinal.length;i++)
	{
		if (szFinal[i]!="")
		{
			szUpdate = szUpdate + szFinal[i] + "\n";
		}
	}
	if (trimTheString(szUpdate) != "")
		document.forms[0].txtEndorsements.value = szUpdate;
	else
		document.forms[0].txtEndorsements.value = "";

	if (document.forms[0].txtXMLEndorsement)
		document.forms[0].txtXMLEndorsement.value = XMLAllAttribs;
	szUpdate = "";
}


// Fucntion FormatDate
// Added by Annal
// Date added 12 Jan 2001
// Last modified 12 Jan 2001
// Input Date, FormName, FieldName
// Purpose	To format the Date value

/*
	Commented by Balaji. V and the same is moved to Ebixinclude.inc
	Purpose: Date should be Validated according to the  country specific
	
*/

/*function FormatDate(szFormName,szFieldName)
{
	var strDate;
	var strDay;
	var strMonth;
	var strYear;
	
	var objVal;
	
	ObjVal =eval('document.'+szFormName+'.'+szFieldName);
	
	if (ObjVal.value=="")
	{
	   return true;
	}
	
	if (IsProperDate(ObjVal)==true)
		{
			// After coming out of 'IsProperDate' function if the date value contains '/' then 
			// it means that the value is of correct format. So this value is returned
			if (FindChar(ObjVal.value,"/")==true)
			{
			  strDate = ObjVal.value;
			}
			else if (ObjVal.value.length == 8)
			{
				strDay   = ObjVal.value.charAt(0)+ObjVal.value.charAt(1)
				strMonth = ObjVal.value.charAt(2)+ObjVal.value.charAt(3)
				strYear  = ObjVal.value.charAt(4)+ObjVal.value.charAt(5)+ObjVal.value.charAt(6)+ObjVal.value.charAt(7)
	
				strDate  = strDay +"/"+ strMonth +"/"+ strYear
			}
			else if (ObjVal.value.length == 6)
			{
				strDay   = "0"+ ObjVal.value.charAt(0)
				strMonth = "0" + ObjVal.value.charAt(1)
				strYear  = ObjVal.value.charAt(2)+ObjVal.value.charAt(3)+ObjVal.value.charAt(4)+ObjVal.value.charAt(5)
	
				strDate  = strDay +"/"+ strMonth +"/"+ strYear
			}					
			ObjVal.value=strDate;
			
			return true;
		}
	else
		{
			ObjVal.focus();
			return false;
		}
}*/


// To find whether there is '/' character present in the date value.

function FindChar(strValue,strChar)
    {
		for(i=0;i<strValue.length;i++)
		{
			if (strValue.charAt(i)==strChar)
			{
				return true;
			}
		}
		return false;
    }
    
// To validate the date value (MM/DD/YYYY) or (M/D/YYYY) or (MMDDYYYY) or (MDYYYY) format
    
/*function IsProperDate(ctr)
   	{   		
			if (ctr.value.length > 10)
			{
			     alert("Date length cannot exceed 10 characters");
			     ctr.focus()
			     return false;
			}
			     
			if(ctr.value.length!=10 && ctr.value.length!=9 && ctr.value.length!=8 && ctr.value.length!=6)
			{
			   alert("Enter Date in (MM/DD/YYYY) or (M/D/YYYY) or (MMDDYYYY) or (MDYYYY) format");
			   ctr.focus()
			   return false;
			}


			if(ctr.value.length==10)
			{
				 if ((ctr.value.charAt(2) != "/") || (ctr.value.charAt(5) != "/"))
			     		{
					   alert("Enter Date in (MM/DD/YYYY) or (M/D/YYYY) or (MMDDYYYY) or (MDYYYY) format");
					   ctr.focus()
					   return false;
					}
				nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
				numday   = ctr.value.charAt(3)+ctr.value.charAt(4)
				numyear  = ctr.value.charAt(6)+ctr.value.charAt(7) + ctr.value.charAt(8)+ctr.value.charAt(9)
			}

			if(ctr.value.length==8)
			{
				if ((ctr.value.charAt(1) != "/") || (ctr.value.charAt(3) != "/"))
				{
				   
				   if (FindChar(ctr.value,"/")==true)
				   {
						alert("Enter Date in (MM/DD/YYYY) or (M/D/YYYY) or (MMDDYYYY) or (MDYYYY) format");
						ctr.focus()
						return false;
				   }
				   else
				   {
						nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
						numday   = ctr.value.charAt(2)+ctr.value.charAt(3)
						numyear  = ctr.value.charAt(4)+ctr.value.charAt(5) + ctr.value.charAt(6)+ctr.value.charAt(7)
				   }	
				}
				else
				{
					nummonth = ctr.value.charAt(0)
					numday   = ctr.value.charAt(2)
					numyear  = ctr.value.charAt(4)+ctr.value.charAt(5) + ctr.value.charAt(6)+ctr.value.charAt(7)
				}	
			}	

			if(ctr.value.length==9)
			{
				if (((ctr.value.charAt(1) != "/") || (ctr.value.charAt(4) != "/")) &&((ctr.value.charAt(2) != "/") || (ctr.value.charAt(4) != "/")))
				{
				   alert("Enter Date in (MM/DD/YYYY) or (M/D/YYYY) or (MMDDYYYY) or (MDYYYY) format");
				   ctr.focus()
				   return false;
				}
				if (ctr.value.charAt(1)== "/") 
				{
						nummonth = ctr.value.charAt(0)
						numday   = ctr.value.charAt(2)+ctr.value.charAt(3)
						numyear  = ctr.value.charAt(5) + ctr.value.charAt(6)+ctr.value.charAt(7)+ ctr.value.charAt(8)
				}
				else
				{
						nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
						numday   = ctr.value.charAt(3)
						numyear  = ctr.value.charAt(5) + ctr.value.charAt(6)+ctr.value.charAt(7)+ ctr.value.charAt(8)
				}
			}	
 
            if(ctr.value.length==6)
			{
				nummonth = ctr.value.charAt(0)
				numday   = ctr.value.charAt(1)
				numyear  = ctr.value.charAt(2)+ctr.value.charAt(3) + ctr.value.charAt(4)+ctr.value.charAt(5)
				
			}	


				if (numyear.length < 4)
				{
					alert("Year format is YYYY")
					return false;
				}
				 
				if (!IsVal("Day value in date",numday))
				{
					return false;
				}
				if (!IsVal("Month value in date",nummonth))
				{
					return false;
				}
				if (!IsVal("Year value in date",numyear)) 
				{
					return false;
				}
				day = parseInt(numday,10)
				month = parseInt(nummonth,10)
				year = parseInt(numyear,10)
			    if (isNaN(day) || isNaN(month) || isNaN(year))
			    {
					alert("Invalid Date");
					return false;
				}
			       
				if ((day < 0) || (month < 0) || (year < 0))
				{
					alert("Invalid character in Date");
					return false;
				}
				if ((day == 0) || (month == 0) || (year == 0))
				{
					alert("Invalid Date");
					return false;
				}
			    if (month > 12)
				{
				   alert("Month cannot be greater than 12");
				   return false;
				}

				if (day > 31 )
				{
				     alert("Day cannot be greater than 31")
				     return false;
				}
				if ((month==4)||(month==6)||(month==9)||(month==11))
				{
					if (day > 30 ) 
				    {
				        alert("Day cannot be greater than 30")
				        return false;
				    }
				}
				if (month==2)
				{
					if  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) 
				    {
						if (day > 29)
				        {
							alert("Day cannot be greater than 29 for a Leap Year")
				            return false;
				        }        
				               
				    }  
				    else     
				    {
				        if (day > 28)
				        {
							alert("Day cannot be greater than 28 for a non-leap year")
				            return false;
				        } 
				    }    
				}  
				if (numyear < 1900)
				{
					alert("Year cannot be less than 1900.");
					return false;
				}
				return true;
	}*/
   
   // End of Addition by Annal Ahmed
   
   
   //Additon by Ravi - for vehicle forms fly popup
   	/*
	txtYear,		-		This is the String format of Year form Obj Name
	txtMake, 		-		This is the String format of Make form Obj Name
	txtModel, 		-		This is the String format of Model form Obj Name
	txtVin, 		-		This is the String format of VIN form Obj Name
	frmName, 		-		This is the String Form Name
	PopupValue 		-		This is the String to differentiate between (YEAR/ MAKE / MODEL)
	*/
	function VehiclePopUp1(txtYear, txtMake, txtModel, txtVin, frmName, PopupValue, txtMakeDesc )
	{
		var lstrYear  = eval("document." + frmName + "." + txtYear + ".value" )
		var lstrMake  = eval("document." + frmName + "." + txtMake + ".value" )
		var lstrModel  = eval("document." + frmName + "." + txtModel + ".value" )
		var lstrMakeDesc = eval("document." + frmName + "." + txtMakeDesc + ".value" )

		var valueQS = "&lstrYear=" + lstrYear + "&lstrMake=" + lstrMake + "&lstrModel=" + lstrModel + "&lstrMakeDesc=" + lstrMakeDesc
		var textQS = "txtYear=" + txtYear + "&txtMake=" + txtMake + "&txtModel=" + txtModel + "&txtVin=" + txtVin + "&frmName=" + frmName + "&PopupValue=" + PopupValue

		//var retVal = window.open("../Search/VehicleLookupPage.asp?" + textQS + valueQS, "LookUp","toolbar=no,width=400,height=500,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no")
		ShowPopupParams('../Search/VehicleLookupPage.asp?' + textQS + valueQS,"LookUp",400,500,0,0)
	}
	// Added By Tapas to Implement the Issue # 1450 of the doc 9002
	
	function VehiclePopUp(txtYear, txtMake, txtModel, txtVin, frmName, PopupValue, txtMakeDesc )
	{
		var lstrYear  = eval("document." + frmName + "." + txtYear + ".value" )
		var lstrMake  = eval("document." + frmName + "." + txtMake + ".value" )
		var lstrModel  = eval("document." + frmName + "." + txtModel + ".value" )
		var lstrMakeDesc = eval("document." + frmName + "." + txtMakeDesc + ".value" )
		var lstrVIN		= eval("document." + frmName + "." + txtVin + ".value" )	
		
		var valueQS = "&lstrYear=" + lstrYear + "&lstrMake=" + lstrMake + "&lstrModel=" + lstrModel + "&lstrMakeDesc=" + lstrMakeDesc + "&lstrVIN=" + lstrVIN
		var textQS = "txtYear=" + txtYear + "&txtMake=" + txtMake + "&txtModel=" + txtModel + "&txtVin=" + txtVin + "&frmName=" + frmName + "&PopupValue=" + PopupValue
		
		//var retVal = window.open("../Search/VehicleLookupPage.asp?" + textQS + valueQS, "LookUp","toolbar=no,width=600,height=250,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no")
		ShowPopupParams('../Search/VehicleLookupPage.asp?' + textQS + valueQS,"LookUp",650,300,0,0)
	}
	function VehiclePopUp2(txtYear, txtMake, txtModel, txtVin, frmName, PopupValue, txtMakeDesc,txtCarrVehNo )
	{
		//alert(frmName);
		var lstrYear  = eval("document." + frmName + "." + txtYear + ".value" )
		var lstrMake  = eval("document." + frmName + "." + txtMake + ".value" )
	    var lstrModel  = eval("document." + frmName + "." + txtModel + ".value" )
		var lstrMakeDesc = eval("document." + frmName + "." + txtMakeDesc + ".value" )
		var lstrVIN		= eval("document." + frmName + "." + txtVin + ".value" )	
		var lstrCarrVehNo	= eval("document." + frmName + "." + txtCarrVehNo + ".value" )
		//alert("hello4")
		var valueQS = "&lstrYear=" + lstrYear + "&lstrMake=" + lstrMake + "&lstrModel=" + lstrModel + "&lstrMakeDesc=" + lstrMakeDesc + "&lstrVIN=" + lstrVIN + "&lstrCarrVehNo=" + lstrCarrVehNo
		var textQS = "txtYear=" + txtYear + "&txtMake=" + txtMake + "&txtModel=" + txtModel + "&txtVin=" + txtVin + "&frmName=" + frmName + "&txtCarrVehNo=" + txtCarrVehNo +  "&PopupValue=" + PopupValue 
		
		//var retVal = window.open("../Search/VehicleLookupPage1.asp?" + textQS + valueQS, "LookUp","toolbar=no,width=600,height=250,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no")
		ShowPopupParams('../Search/VehicleLookupPage1.asp?' + textQS + valueQS,"LookUp",650,300,0,0)
	}
	

   //Additon by Balaji - for maintaining the Year/Make/Model/VIN Details
   	/*
	selVin			-		This is the String format of Year/Make/Model/VIN
	txtYear,		-		This is the String format of Year form Obj Name
	txtMake, 		-		This is the String format of Make form Obj Name
	txtModel, 		-		This is the String format of Model form Obj Name
	txtVin, 		-		This is the String format of VIN form Obj Name
	frmName 		-		This is the String Form Name
	*/
	//function VehicleDtlsPopUp(txtYear, txtMake, txtModel, txtVin, frmName)
	function VehicleDtlsPopUp(selVin, frmName)
	{		
		lstrYMMV = eval("document." + frmName + "." + selVin + ".value")		
		var retVal = window.open("../Search/VehicleMaintenancePage.asp?txtYMMV=" + lstrYMMV, "LookUp","toolbar=no,width=400,height=515,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no")
		/*
		var lstrYear  = eval("document." + frmName + "." + txtYear + ".value" )
		var lstrMake  = eval("document." + frmName + "." + txtMake + ".value" )
		var lstrModel  = eval("document." + frmName + "." + txtModel + ".value" )
		var lstrMakeDesc = eval("document." + frmName + "." + txtVin + ".value" )
		

		var valueQS = "&lstrYear=" + lstrYear + "&lstrMake=" + lstrMake + "&lstrModel=" + lstrModel + "&lstrMakeDesc=" + lstrMakeDesc
		var textQS = "txtYear=" + txtYear + "&txtMake=" + txtMake + "&txtModel=" + txtModel + "&txtVin=" + txtVin + "&frmName=" + frmName + "&PopupValue=" + PopupValue

		//var retVal = window.open("../Search/VehicleLookupPage.asp?" + textQS + valueQS, "LookUp","toolbar=no,width=400,height=500,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no")
		ShowPopupParams('../Search/VehicleLookupPage.asp?' + textQS + valueQS,"LookUp",400,500,0,0)
		*/
	}
	
	
			/*----------------------------------------------------------------------
			Function Name           DateValidation(ctr)
			Author                  Annal Ahmed
			Purpose					To validate the date in MM/YYYY or MM/DD/YYYY format   
			
			Creation Date           13 DEC 2000
			Last Modified Date      13 DEC 2000
			------------------------------------------------------------------------*/
/*
	Commented by Balaji. V and the same is moved to Ebixinclude.inc
	Purpose: Date should be Validated according to the  country specific
	
*/

/*			function DateValidation(ctr)
			{
				var nummonth = "0";
				var numday   = "0";
				var numyear  = "0";
				 
				if (ctr.value.length == 0) 
				{
					return true;
				}
				
				if (ctr.value.length != 10 && ctr.value.length != 9 && ctr.value.length != 8  && ctr.value.length != 7 && ctr.value.length !=6)
				{
					alert("Enter Date in MM/DD/YYYY or MM/YYYY format.");
					return false;
				}
				
				if (ctr.value.length == 10)      // mm/dd/yyyy
				{
					if ((ctr.value.charAt(2) != "/") || (ctr.value.charAt(5) != "/"))
			 		{
					   alert("Enter Date in MM/DD/YYYY or MM/YYYY format.");
					   return false;
					}
					nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
					numday   = ctr.value.charAt(3)+ctr.value.charAt(4)
					numyear  = ctr.value.charAt(6)+ctr.value.charAt(7)+ctr.value.charAt(8)+ctr.value.charAt(9)  
				}
				
				else if (ctr.value.length == 9)      // m/dd/yyyy or mm/d/yyyy
				{
					if (((ctr.value.charAt(1) != "/") && (ctr.value.charAt(2) != "/")) || (ctr.value.charAt(4) != "/")) 
			 		{
					   alert("Enter Date in MM/DD/YYYY or MM/YYYY format.");
					   return false;
					}
					if (ctr.value.charAt(1) == "/") // m/dd/yyyy
			 		{
						nummonth = ctr.value.charAt(0)
						numday   = ctr.value.charAt(2)+ctr.value.charAt(3)
						numyear  = ctr.value.charAt(5)+ctr.value.charAt(6)+ctr.value.charAt(7)+ctr.value.charAt(8)     
					}
					else if(ctr.value.charAt(2) == "/") // mm/d/yyyy
					{
						nummonth = ctr.value.charAt(0)+ ctr.value.charAt(1)
						numday   = ctr.value.charAt(3)
						numyear  = ctr.value.charAt(5)+ctr.value.charAt(6)+ctr.value.charAt(7)+ctr.value.charAt(8)     
					}
					
				}
				
				else if (ctr.value.length == 8)      // m/d/yyyy
				{
					if ((ctr.value.charAt(1) != "/") || (ctr.value.charAt(3) != "/"))
			 		{
					   alert("Enter Date in MM/DD/YYYY or MM/YYYY format.");
					   return false;
					}
					nummonth = ctr.value.charAt(0)
					numday   = ctr.value.charAt(2)
					numyear  = ctr.value.charAt(4)+ctr.value.charAt(5)+ctr.value.charAt(6)+ctr.value.charAt(7)  
				}
				
				else if (ctr.value.length == 7) // mm/yyyy
				{
					if (ctr.value.charAt(2) != "/")
				    {
						alert("Enter Date in MM/DD/YYYY or MM/YYYY format.");
						return false;
					}
					nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
					numday   = "01"
					numyear  = ctr.value.charAt(3)+ctr.value.charAt(4)+ctr.value.charAt(5)+ctr.value.charAt(6)  
				}
				else if (ctr.value.length == 6)  // m/yyyy
				{
					if (ctr.value.charAt(1) != "/")
				    {
						alert("Enter Date in MM/DD/YYYY or MM/YYYY format.");
						return false;
					}
					nummonth = ctr.value.charAt(0)
					numday   = "01"
					numyear  = ctr.value.charAt(2)+ctr.value.charAt(3)+ctr.value.charAt(4)+ctr.value.charAt(5)  
				}
				
				
				if (numyear.length != 4)
				{
					alert("Year format is YYYY")
					return false;
				}
				 
				if (!IsVal("Day value in date",numday))
				{
					return false;
				}
				if (!IsVal("Month value in date",nummonth))
				{
					return false;
				}
				if (!IsVal("Year value in date",numyear)) 
				{
					return false;
				}
				
				day   = parseInt(numday,10)
				month = parseInt(nummonth,10)
				year  = parseInt(numyear,10)
				if (isNaN(day) || isNaN(month) || isNaN(year))
				{
					alert("Invalid Date");
					return false;
				}
				   
				if ((day < 0) || (month < 0) || (year < 0))
				{
					alert("Invalid character in Date");
					return false;
				}
				if ((day == 0) || (month == 0))
				{
					alert("Invalid Date");
					return false;
				}
				if (month > 12)
				{
				   alert("Month can not be greater than 12");
				   return false;
				}

				if (day > 31 )
				{
				     alert("Day can not be greater than 31")
				     return false;
				}
				if ((month==4)||(month==6)||(month==9)||(month==11))
				{
				    if (day > 30 ) 
				    {
				        alert("Day can not be greater than 30")
				        return false;
				    }
				}
				if (month==2)
			    {
					if  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) 
				    {
						if (day > 29)
				        {
				            alert("Day can not be greater than 29 for a Leap Year")
				            return false;
				        }        
				               
				    }  
				    else     
				    {
						if (day > 28)
				        {
							alert("Day can not be greater than 28 for a non-leap year")
				            return false;
				        } 
				    }    
				}  
				if (numyear < 1900)
				{
					alert("Year can not be less than 1900.");
					return false;
				}
				return true;
			}*/
			
		/*----------------------------------------------------------------------
			Function Name           DateValidation(ctr)
			Author                  Annal Ahmed
			Modified By				Tapas Ranjan Paul
			Purpose					To validate the date in MM/YYYY or MM/DD/YYYY format   
			
			Creation Date           2nd April 2001
			Last Modified Date      2nd April 2001
			------------------------------------------------------------------------*/	
		function DateValidation1(ctr)
			{
				var nummonth = "0";
				var numday   = "0";
				var numyear  = "0";
				 
				if (ctr.value.length == 0) 
				{
					return true;
				}
				
				if (ctr.value.length != 10 && ctr.value.length != 9 && ctr.value.length != 8  && ctr.value.length != 7 && ctr.value.length !=6)
				{
					alert("Enter Date in MM/YYYY or M/YYYY format.");
					return false;
				}
				
				if (ctr.value.length == 10)      // mm/dd/yyyy
				{
					if ((ctr.value.charAt(2) != "/") || (ctr.value.charAt(5) != "/"))
			 		{
					   alert("Enter Date in MM/YYYY or M/YYYY format.");
					   return false;
					}
					nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
					numday   = ctr.value.charAt(3)+ctr.value.charAt(4)
					numyear  = ctr.value.charAt(6)+ctr.value.charAt(7)+ctr.value.charAt(8)+ctr.value.charAt(9)  
				}
				
				else if (ctr.value.length == 9)      // m/dd/yyyy or mm/d/yyyy
				{
					if (((ctr.value.charAt(1) != "/") && (ctr.value.charAt(2) != "/")) || (ctr.value.charAt(4) != "/")) 
			 		{
					   alert("Enter Date in MM/YYYY or MM/YYYY format.");
					   return false;
					}
					if (ctr.value.charAt(1) == "/") // m/dd/yyyy
			 		{
						nummonth = ctr.value.charAt(0)
						numday   = ctr.value.charAt(2)+ctr.value.charAt(3)
						numyear  = ctr.value.charAt(5)+ctr.value.charAt(6)+ctr.value.charAt(7)+ctr.value.charAt(8)     
					}
					else if(ctr.value.charAt(2) == "/") // mm/d/yyyy
					{
						nummonth = ctr.value.charAt(0)+ ctr.value.charAt(1)
						numday   = ctr.value.charAt(3)
						numyear  = ctr.value.charAt(5)+ctr.value.charAt(6)+ctr.value.charAt(7)+ctr.value.charAt(8)     
					}
					
				}
				
				else if (ctr.value.length == 8)      // m/d/yyyy
				{
					if ((ctr.value.charAt(1) != "/") || (ctr.value.charAt(3) != "/"))
			 		{
					   alert("Enter Date in MM/YYYY or M/YYYY format.");
					   return false;
					}
					nummonth = ctr.value.charAt(0)
					numday   = ctr.value.charAt(2)
					numyear  = ctr.value.charAt(4)+ctr.value.charAt(5)+ctr.value.charAt(6)+ctr.value.charAt(7)  
				}
				
				else if (ctr.value.length == 7) // mm/yyyy
				{
					if (ctr.value.charAt(2) != "/")
				    {
						alert("Enter Date in MM/YYYY or M/YYYY format.");
						return false;
					}
					nummonth = ctr.value.charAt(0)+ctr.value.charAt(1)
					numday   = "01"
					numyear  = ctr.value.charAt(3)+ctr.value.charAt(4)+ctr.value.charAt(5)+ctr.value.charAt(6)  
				}
				else if (ctr.value.length == 6)  // m/yyyy
				{
					if (ctr.value.charAt(1) != "/")
				    {
						alert("Enter Date in MM/YYYY or M/YYYY format.");
						return false;
					}
					nummonth = ctr.value.charAt(0)
					numday   = "01"
					numyear  = ctr.value.charAt(2)+ctr.value.charAt(3)+ctr.value.charAt(4)+ctr.value.charAt(5)  
				}
				
				
				if (numyear.length != 4)
				{
					alert("Year format is YYYY")
					return false;
				}
				 
				if (!IsVal("Day value in date",numday))
				{
					return false;
				}
				if (!IsVal("Month value in date",nummonth))
				{
					return false;
				}
				if (!IsVal("Year value in date",numyear)) 
				{
					return false;
				}
				
				day   = parseInt(numday,10)
				month = parseInt(nummonth,10)
				year  = parseInt(numyear,10)
				if (isNaN(day) || isNaN(month) || isNaN(year))
				{
					alert("Invalid Date");
					return false;
				}
				   
				if ((day < 0) || (month < 0) || (year < 0))
				{
					alert("Invalid character in Date");
					return false;
				}
				if ((day == 0) || (month == 0))
				{
					alert("Invalid Date");
					return false;
				}
				if (month > 12)
				{
				   alert("Month can not be greater than 12");
				   return false;
				}

				if (day > 31 )
				{
				     alert("Day can not be greater than 31")
				     return false;
				}
				if ((month==4)||(month==6)||(month==9)||(month==11))
				{
				    if (day > 30 ) 
				    {
				        alert("Day can not be greater than 30")
				        return false;
				    }
				}
				if (month==2)
			    {
					if  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) 
				    {
						if (day > 29)
				        {
				            alert("Day can not be greater than 29 for a Leap Year")
				            return false;
				        }        
				    }  
				    else     
				    {
						if (day > 28)
				        {
							alert("Day can not be greater than 28 for a non-leap year")
				            return false;
				        } 
				    }    
				}  
				if (numyear < 1900)
				{
					alert("Year can not be less than 1900.");
					return false;
				}
				return true;
			}
			
	/*-------------------------------------------------------------------------------------------------------------
	Function Name      : RemoveChar()
	Author             : Tapas Ranjan Paul
	Purpose            : To remove the a particular character
	Creation Date      : 15/06/2001
	Last Modified Date : 
	---------------------------------------------------------------------------------------------------------------*/
			
	
	function RemoveChar(szUserValue,szChar)
	{
	   var szNewValue="";
	    var i=0; 
		 for(i=0;i<szUserValue.length;i=i+1)
	    { 
	     if (szUserValue.charAt(i)!=szChar)
			szNewValue = szNewValue + szUserValue.charAt(i)
	    }
	    return szNewValue;
	}
	ShowPopup
	/*-------------------------------------------------------------------------------------------------------------
Function Name      : FormatDollar()
Author             : Tapas Ranjan Paul
Purpose            : To format dollar fields 
Creation Date      : 15/06/2001
Last Modified Date : 
---------------------------------------------------------------------------------------------------------------*/
function FormatDollar(szFormName,szFieldName,NumbertoChange,strChar)
{
	var lintLoopCounter, decimalLocation, lboolValueChanged = "0"
	var afterDecimal, beforeDecimal, revString = "", commaString = "", lstrFinal = ""; 
	var ReturnString,szNegSign,szPostSign
	szNegSign = ""
	szPostSign = ""

	if (FindChar(NumbertoChange,",") == false)
	{
		if (FindChar(NumbertoChange,"-") == true)
		{
			NumbertoChange = RemoveChar(NumbertoChange,"-")
			szNegSign = "1"
		}	
		if (FindChar(NumbertoChange,"+") == true)
		{
			NumbertoChange = RemoveChar(NumbertoChange,"+")
			szPostSign = "1"	
		}	

		lboolValueChanged = "1"
		decimalLocation = NumbertoChange.indexOf(".");
		//alert(decimalLocation)
		if (decimalLocation == "-1" )
			decimalLocation = NumbertoChange.length
		afterDecimal = NumbertoChange.substr(decimalLocation+1)
		beforeDecimal = NumbertoChange.substr(0,decimalLocation)
	
		for (lintLoopCounter=beforeDecimal.length-1; lintLoopCounter >= 0 ; lintLoopCounter--)
			revString = revString + beforeDecimal.charAt(lintLoopCounter)
	
		for (lintLoopCounter=0; lintLoopCounter <= revString.length-1 ; lintLoopCounter+=3 )
			commaString = commaString + revString.substr(lintLoopCounter, 3) + ","

		if (commaString.charAt(commaString.length-1) == "," )
			commaString = commaString.substr(0, commaString.length-1)

		revString = commaString;
		lstrFinal = ""
		for (lintLoopCounter=revString.length-1; lintLoopCounter >= 0 ; lintLoopCounter--)
			lstrFinal = lstrFinal + revString.charAt(lintLoopCounter)
	
		if (trimTheString(afterDecimal) == "" )
		{
			if (trimTheString(szFormName) == "" )
				ReturnString = lstrFinal + ".00"
			else
				ReturnString = lstrFinal
		}
		else
		{
			ReturnString = lstrFinal + "." + afterDecimal
		}
		
		if (trimTheString(szNegSign) == "1" )
		{			 
			 ReturnString = "-" + ReturnString 
		}
		else if (trimTheString(szPostSign) == "1" )
			ReturnString = "+" + ReturnString 
		else
			ReturnString = ReturnString
		//alert(ReturnString);
		//return (ReturnString);
		//obj.value = ReturnString;
		//document.ObjForm.objField.value = ReturnString; 
	}
	
	if (trimTheString(szFormName) != "" )
	{
		if (lboolValueChanged == "1")
		{
			 eval('document.'+szFormName+'.'+szFieldName).value=ReturnString;
		}
		else
		{
			eval('document.'+szFormName+'.'+szFieldName).value=NumbertoChange;		
		}	
	}
	else
	{
		if (lboolValueChanged == "0")
			return NumbertoChange
		else
			return ReturnString
	}
} 



	/*----------------------------------------------------------------------
		Function Name           : FormatDollarPaybs(fieldName)
		Parameters				: fieldName - the contactnation of the FieldName + the Counter.
								  The field name varies between "ConfAgnComm", "ProdConfAmt" ...
		Author                  : Shashidhar Rao. L
		Purpose                 : For Formating the editable values.
			
		Creation Date           : 1st May 2002
		Last Modified Date      : 1st May 2002
		------------------------------------------------------------------------*/
	function FormatDollarPaybs(fieldName)
	{
		var AmtFormat
		AmtFormat = eval('document.' + fieldName).value
		AmtFormat = FormatDollar('', '', AmtFormat, '')	
		AmtFormat = FormatNumberTwoPlace(AmtFormat, 2)
		eval('document.' + fieldName).value = AmtFormat
	}
	
	/*----------------------------------------------------------------------
		Function Name           : FormatDollarPaybsWithNumeric(fieldName)
		Parameters				: fieldName - the contactnation of the FieldName + the Counter.
								  The field name varies between "ConfAgnComm", "ProdConfAmt" ...
		Author                  : Rajan Agarwal
		Purpose                 : This Function checks for numeric valuse first, before editting the values.
								  For Formating the editable values.
			
		Creation Date           : 1st May 2002
		Last Modified Date      : 1st May 2002
		------------------------------------------------------------------------*/
	function FormatDollarPaybsWithNumeric(fieldName)
	{
		objNumericAmount = eval('document.' + fieldName);
		if (isSignedFloat(RemoveChar(objNumericAmount.value, ','))==false)
		{
			objNumericAmount.focus();
			return; 
		}	
		
		var AmtFormat
		AmtFormat = eval('document.' + fieldName).value
		AmtFormat = FormatDollar('', '', AmtFormat, '')	
		AmtFormat = FormatNumberTwoPlace(AmtFormat, 2)
		eval('document.' + fieldName).value = AmtFormat
	}
	
	
	/*----------------------------------------------------------------------
		Function Name           : ShowPopup(url, winname, width, height) 
		Parameters				: url - the url of the popup window
								  winname - name of the popup window
								  width - width of the popup window
								  height - height of the popup window
		Author                  : R Sham
		Purpose                 : Loading the popup window in the center of the screen.
			
		Creation Date           : 12 June 2001
		Last Modified Date      : 12 June 2001
		------------------------------------------------------------------------*/
		function ShowWebsite(url, winname, width, height) 
		{
			
			var MyURL = url;
			var MyWindowName = winname;
			var MyWidth = width;
			var MyHeight = height;
			var MyScrollBars = 'Yes';
			var MyResizable = 'Yes';
			var MyMenuBar = 'Yes';
			var MyToolBar = 'Yes';
			var MyStatusBar = 'Yes';
			var MyAddressbar = 'Yes';

			    if (document.all)
			        var xMax = screen.width, yMax = screen.height;
			    else
			        if (document.layers)
			            var xMax = window.outerWidth, yMax = window.outerHeight;
			        else
			            var xMax = 640, yMax=480;
			    var xOffset = (xMax - MyWidth)/2, yOffset = (yMax - MyHeight)/2;

				var lstrPops = 'width=' + MyWidth + ',height=' + MyHeight + ',screenX= ' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset + ',scrollbars=' + MyScrollBars + ',resizable=' + MyResizable + ',menubar=' + MyMenuBar + ',toolbar=' + MyToolBar + ',status=' + MyStatusBar + ',location=' + MyAddressbar
				window.open(MyURL,MyWindowName, lstrPops);
		}

		/*----------------------------------------------------------------------
		Function Name           : ShowPopup(url, winname, width, height) 
		Parameters				: url - the url of the popup window
								  winname - name of the popup window
								  width - width of the popup window
								  height - height of the popup window
		Author                  : R Sham
		Purpose                 : Loading the popup window in the center of the screen.
			
		Creation Date           : 12 June 2001
		Last Modified Date      : 12 June 2001
		------------------------------------------------------------------------*/
		function ShowPopup(url, winname, width, height) 
		{
			var MyURL = url;
			var MyWindowName = winname;
			var MyWidth = width;
			var MyHeight = height;
			var MyScrollBars = 'Yes';
			var MyResizable = 'Yes';
			var MyMenuBar = 'No';
			var MyToolBar = 'No';
			var MyStatusBar = 'No';

			    if (document.all)
			        var xMax = screen.width, yMax = screen.height;
			    else
			        if (document.layers)
			            var xMax = window.outerWidth, yMax = window.outerHeight;
			        else
			            var xMax = 640, yMax=480;

			    var xOffset = (xMax - MyWidth)/2, yOffset = (yMax - MyHeight)/2;

				//code modified by Balaji. V on 17/April/2002
				//Purpose: To give focus to the child window, even it is already open
				
				//window.open(MyURL,MyWindowName,'width=' + MyWidth + ',height=' + MyHeight + ',screenX= ' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset + ',scrollbars=' + MyScrollBars + ',resizable=' + MyResizable + ',menubar=' + MyMenuBar + ',toolbar=' + MyToolBar + ',status=' + MyStatusBar + '' );
				MyWin = window.open(MyURL,MyWindowName,'width=' + MyWidth + ',height=' + MyHeight + ',screenX= ' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset + ',scrollbars=' + MyScrollBars + ',resizable=' + MyResizable + ',menubar=' + MyMenuBar + ',toolbar=' + MyToolBar + ',status=' + MyStatusBar + '' );
				MyWin.focus();
		}

		/*----------------------------------------------------------------------
		Function Name           : ShowPopupParams(url, winname, width, height) 
		Parameters				: url - the url of the popup window
								  winname - name of the popup window
								  width - width of the popup window
								  height - height of the popup window
		Author                  : R Sham
		Purpose                 : Loading the popup window in the center of the screen.
			
		Creation Date           : 12 June 2001
		Last Modified Date      : 18 Sep 2001
		------------------------------------------------------------------------*/
		function ShowPopupParams(url, winname, width, height, IsResize, IsScroll) 
		{
			var MyURL = url;
			var MyWindowName = winname;
			var MyWidth = width;
			var MyHeight = height;
			var MyScrollBars;
			var MyResizable;
			var MyMenuBar = 'No';
			var MyToolBar = 'No';
			var MyStatusBar = 'No';

			if (IsResize == "1")
				MyResizable = 'Yes';
			if (IsScroll == "1")
				MyScrollBars = 'Yes';
				
			if (document.all)
			    var xMax = screen.width, yMax = screen.height;
			else
			    if (document.layers)
			        var xMax = window.outerWidth, yMax = window.outerHeight;
			    else
			        var xMax = 640, yMax=480;

			var xOffset = (xMax - MyWidth)/2, yOffset = (yMax - MyHeight)/2;
			window.open(MyURL,MyWindowName,'width=' + MyWidth + ',height=' + MyHeight + ',screenX= ' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset + ',scrollbars=' + MyScrollBars + ',resizable=' + MyResizable + ',menubar=' + MyMenuBar + ',toolbar=' + MyToolBar + ',status=' + MyStatusBar + '');
		}

		/*----------------------------------------------------------------------
		Function Name           : setCookieVal(currentName,currentVal,domainName)
		Parameters				: currentName - the name of the cookie to be set
								  currentVal - the value of the cookie to be set
								  domainName - the Application domain variable to be passed
		Author                  : Chetan H
		Purpose                 : To set the cookie
		Creation Date           : 18 Sep 2001
		Last Modified Date      : 
		Note					: The parameter currentName is passed with the '=' sign from 
									the file itself.
		------------------------------------------------------------------------*/
		function setCookieVal(currentName,currentVal,domainName)
		{	
			var CookieNameValue
			CookieNameValue = currentName + currentVal
			cookieText = "" + CookieNameValue + ";path=/;domain=" + domainName + "; expires=wed, 07-06-2010 00:00:02 GMT";
			document.cookie = cookieText
		}
		
		/*----------------------------------------------------------------------
		Function Name           : getCookieVal(currentName)
		Parameters				: currentName - the name of the cookie to retrieve
		Author                  : Chetan H
		Purpose                 : To retrieve the cookie
		Creation Date           : 18 Sep 2001
		Last Modified Date      : 
		Note					: The parameter currentName is passed with the '=' sign from 
									the file itself.		
		------------------------------------------------------------------------*/		
		function getCookieVal(currentName)
		{
			var cookieName = currentName
			var cookieStartIndex=document.cookie.indexOf(cookieName)
			var curMainOpt
			var copyFromWndName
			if (cookieStartIndex == -1)
			{
				copyFromWndName = ""
			}
			var cookieEndIndex = document.cookie.indexOf(";",cookieStartIndex+cookieName.length)
			if (cookieEndIndex == -1)
			{
				cookieEndIndex = document.cookie.length
			}
			copyFromWndName = (unescape(document.cookie.substring(cookieStartIndex + cookieName.length,cookieEndIndex)))
			return(copyFromWndName);
		}
		
		/*----------------------------------------------------------------------
		Function Name           : ShowClientPopup
		Parameters				: To Show the  Popup
		Author                  : Balaji. V
		Purpose                 : 
		Creation Date           : 
		Last Modified Date      : 
		Note					: 
									
		------------------------------------------------------------------------*/		
		function ShowClientPopup(FormName, BaseName, EntityType, EntityValue, SearchCriteria, SelectFrom, PopupFor)
		{
			ldesc = eval(EntityValue).value;
			lstr = "../Search/CarrierCriteriaPopup.asp?FormName=" + FormName + "&BaseName=" + BaseName +"&EntityType=" + EntityType +"&EntityValue=" + ldesc + "&SearchCriteria=" + SearchCriteria + "&SelectFrom=" + SelectFrom + "&PopupFor=" + PopupFor
			ShowPopup(lstr, "NewMainPageWindow", 600, 550)
		}
		
		
		
		// Fucntion FormatDate
		// Added by Tapas
		// Date added 5th Feb 2002
		// Input Date, FormName, FieldName
		// Purpose	To format the Date value

		function TypicalFormatDate(szFormName,szFieldName)
		{
			
			var strDate;
			var strDay;
			var strMonth;
			var strYear;
			
			var objVal;
			
			ObjVal =eval('document.'+szFormName+'.'+szFieldName);
			
			if (ObjVal.value=="")
			{
			   return true;
			}
			
			
			//if (IsProperDate(ObjVal)==true)
				{
					// After coming out of 'IsProperDate' function if the date value contains '/' then 
					// it means that the value is of correct format. So this value is returned
					if (FindChar(ObjVal.value,"/")==true)
					{
					  strDate = ObjVal.value;
					}
					else if (ObjVal.value.length == 6)
					{
						strMonth   = ObjVal.value.charAt(0)+ObjVal.value.charAt(1)
						strYear  = ObjVal.value.charAt(2)+ObjVal.value.charAt(3)+ObjVal.value.charAt(4)+ObjVal.value.charAt(5)
			
						strDate  = strMonth +"/"+ strYear
					}
					else if (ObjVal.value.length == 5)
					{
						strMonth = "0" + ObjVal.value.charAt(0)
						strYear  = ObjVal.value.charAt(1)+ObjVal.value.charAt(2)+ObjVal.value.charAt(3)+ObjVal.value.charAt(4)
			
						strDate  =  strMonth +"/"+ strYear
					}					
					ObjVal.value=strDate;
					
					return true;
				}
			//else
			//	{
			//		ObjVal.focus();
			//		return false;
			//	}
		}
		
		
	/*-------------------------------------------------------------------------------------------------------------
	Function Name      : fn_ClaimsLookupWindow
	Author             : Sudheer Ravindran
	Purpose            : To Open the Contact Details Lookup
	Creation Date      : 12/02/2002
	Last Modified Date :
	 
	---------------------------------------------------------------------------------------------------------------*/
    function fn_ClaimsLookupWindow(formName, txtFieldName, lookUpCode, selValue, DisplayFlag, DisplaySaveFlag, ReturnCode,submitFormFunc,submitFuncName)
	{ 
		var lstr, lloc, ldesc;
		ldesc = selValue.value;
		lloc = ldesc.indexOf(":");
		ldesc = ldesc.substring(lloc+1, ldesc.length);
		ldesc = trimTheString(ldesc)
		
		lstr = "../Claims/ClaimsLookUp.asp?formname=" + formName + "&fieldname=" + txtFieldName +"&LookUpID=" + escape(lookUpCode) +"&fieldvalue=" + ldesc + "&DisplayFlag=" + DisplayFlag + "&DisplaySaveFlag=" + DisplaySaveFlag  + "&ReturnCode=" + ReturnCode + "&submitFormFunc=" + submitFormFunc + "&submitFuncName=" + submitFuncName
				// Commented by Piyush on 18 Sep 2001
		// To open the new window in centre
		//newWindow = window.open(lstr,"NewMainPageWindow","toolbar=no,width=400,height=600,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no");
		ShowPopup(lstr,"NewMainPageWindow",435,580)
	}
	
	
	
	/*-------------------------------------------------------------------------------------------------------------
	Function Name      : BuildDateForCnty
	Parameters		   : Date Object, Format for which country
	Author             : Balaji. V
	Purpose            : To Change the date value to the country specific, so that it will be use in new Date() Contructor in Javascript
	Creation Date      : 25/Feb/2002
	Last Modified Date :
	---------------------------------------------------------------------------------------------------------------*/
	function BuildDateForCnty(dtObj, FormatFor)
	{
		var varErrorMsg;
		var dtDSep;
		var intDateValueLength = dtObj.value.length;
		var dtDateValue = dtObj.value;
		var strDate = "";
		var nummonth; // Added By Namit on 20/1/2003 To Remove NumMonth Problem
		var numday;   // Added By Namit on 20/1/2003 To Remove NumMonth Problem
		var numyear;  // Added By Namit on 20/1/2003 To Remove NumMonth Problem
		if (trimTheString(dtDateValue) == "")
			return true;
		
		/*********
		Extracting the separator
		*********/
	   	dtDSep = GetDateSeparator(dtDateValue);
	   	if(dtDSep =="")
	   		dtDSep = "/"
	   	else(dtDSep ==" ")
	   	{
	   		dtDSep = "/"
	   		dtDateValue = ReplaceString(dtDateValue," ", "")
	   	}
		//*********

				
		if(intDateValueLength==10)
		{
			nummonth = dtDateValue.charAt(0)+dtDateValue.charAt(1)
			numday   = dtDateValue.charAt(3)+dtDateValue.charAt(4)
			numyear  = dtDateValue.charAt(6)+dtDateValue.charAt(7) + dtDateValue.charAt(8)+dtDateValue.charAt(9)
		}
				
		if(intDateValueLength==8)
		{
			if ((dtDateValue.charAt(1) != dtDSep) || (dtDateValue.charAt(3) != dtDSep))
			{
				nummonth = dtDateValue.charAt(0)+dtDateValue.charAt(1)
				numday   = dtDateValue.charAt(2)+dtDateValue.charAt(3)
				numyear  = dtDateValue.charAt(4)+dtDateValue.charAt(5) + dtDateValue.charAt(6)+dtDateValue.charAt(7)
			}
			else
			{
				nummonth = dtDateValue.charAt(0)
				numday   = dtDateValue.charAt(2)
				numyear  = dtDateValue.charAt(4)+dtDateValue.charAt(5) + dtDateValue.charAt(6)+dtDateValue.charAt(7)
			}
		}
		if(intDateValueLength==9)
		{
			if (dtDateValue.charAt(1)== dtDSep) 
			{
				nummonth = dtDateValue.charAt(0)
				numday   = dtDateValue.charAt(2)+dtDateValue.charAt(3)
				numyear  = dtDateValue.charAt(5) + dtDateValue.charAt(6)+dtDateValue.charAt(7)+ dtDateValue.charAt(8)
			}
			else
			{
				nummonth = dtDateValue.charAt(0)+dtDateValue.charAt(1)
				numday   = dtDateValue.charAt(3)
				numyear  = dtDateValue.charAt(5) + dtDateValue.charAt(6)+dtDateValue.charAt(7)+ dtDateValue.charAt(8)
			}
		}	

		if(intDateValueLength==6)
		{
			nummonth = dtDateValue.charAt(0)
			numday   = dtDateValue.charAt(1)
			numyear  = dtDateValue.charAt(2)+dtDateValue.charAt(3) + dtDateValue.charAt(4)+dtDateValue.charAt(5)
							
		}
				
		//swaping based on country
		// Here we are swapping the fields based on the country
		// If different date format comes than we need to manipulate the swapping of MM DD YYYY accordingly
		if(FormatFor == 'E')
		{
			tempVar = nummonth;
			nummonth = numday;
			numday = tempVar;
		}
		strDate = nummonth + "/" + numday + "/" + numyear
		return strDate;
	}
	//End Function
	
	/*-------------------------------------------------------------------------------------------------------------
	Function Name      : ReplaceDateSeparator
	Parameters		   : Date Value
	Author             : Balaji. V
	Purpose            : To Replace the Date Separator to "/", to use the new Date() constructor in Javascript
	Creation Date      : 25/Feb/2002
	Last Modified Date : 
	---------------------------------------------------------------------------------------------------------------*/
	function ReplaceDateSeparator(dtDateValue)
	{
		var dtDSep;
	   	dtDSep = GetDateSeparator(dtDateValue);
	   	if(dtDSep =="")
	   		dtDSep = "/"
	   	else(dtDSep ==" ")
	   	{
	   		dtDSep = "/"
	   		dtDateValue = ReplaceString(dtDateValue," ", "")
	   	}
		retDateValue = dtDateValue;
		retDateValue = ReplaceString(dtDateValue, dtDSep, "/");
		return retDateValue;
	}
	
	/*----------------------------------------------------------------------
		Function Name           : ShowPopupExcel(url, winname, width, height) 
		Parameters				: url - the url of the popup window
								  winname - name of the popup window
								  width - width of the popup window
								  height - height of the popup window
		Author                  : Rohit Sinha
		Purpose                 : Loading the popup window in the center of the screen.
			
		Creation Date           : 01 March 2002
		Last Modified Date      : 01 March 2002
		------------------------------------------------------------------------*/
		function ShowPopupExcel(url, winname, width, height) 
		{
			var MyURL = url;
			var MyWindowName = winname;
			var MyWidth = width;
			var MyHeight = height;
			var MyScrollBars = 'Yes';
			var MyResizable = 'Yes';
			var MyMenuBar = 'Yes';
			var MyToolBar = 'Yes';
			var MyStatusBar = 'No';

			    if (document.all)
			        var xMax = screen.width, yMax = screen.height;
			    else
			        if (document.layers)
			            var xMax = window.outerWidth, yMax = window.outerHeight;
			        else
			            var xMax = 640, yMax=480;

			    var xOffset = (xMax - MyWidth)/2, yOffset = (yMax - MyHeight)/2;

				//alert(MyURL);
				//window.open(MyURL);
				window.open(MyURL,MyWindowName,'width=' + MyWidth + ',height=' + MyHeight + ',screenX= ' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset + ',scrollbars=' + MyScrollBars + ',resizable=' + MyResizable + ',menubar=' + MyMenuBar + ',toolbar=' + MyToolBar + ',status=' + MyStatusBar + '');
					
		}
		


//------------------------------------------------------------------------------------------
//  Name   :getCookie
//  Author :Balaji RJ
//  Date   :05/14/2003  
//  Purpose:To Retrieve the cookie value using Java Script Function	
//------------------------------------------------------------------------------------------

function getCookie(Name)
 {
	var search = Name + "="
	if (document.cookie.length > 0) 
	{		
			// if there are any cookies
			offset = document.cookie.indexOf(search)
			if (offset != -1) 
				{
					// if cookie exists
					offset += search.length
					// set index of beginning of value
					end = document.cookie.indexOf(";", offset)
					// set index of end of cookie value
					if (end == -1)
					end = document.cookie.length
					return unescape(document.cookie.substring(offset, end))
				}
	}
} 

//------------------------------------------------------------------------------------------
//End Function getCookie by Balaji RJ
//------------------------------------------------------------------------------------------
		/*----------------------------------------------------------------------
		Function Name           : changeBtnColor(color) 
		Parameters				: Color - The color to be displayed onMouserOver and onMouseOut on the btn
		Author                  : Balaji. V
		Purpose                 : This function is used for People's Choice.
								  This function is called on the buttons which is found at the bottom of every page
		Creation Date           : 22 March 2002
		Last Modified Date      : 22 March 2002
		------------------------------------------------------------------------*/

		function changeBtnColor(color)
		{
			var el= event.srcElement
			if (el) 
			{
				if ((el.tagName=="INPUT"&&el.type=="button") || (el.tagName=="INPUT"&&el.type=="submit"))
				event.srcElement.style.backgroundColor=color

			}
		}
		
		
		
		/*----------------------------------------------------------------------
		Function Name           : ScriptOnOff() 
		Parameters				: szSpanName	- Span Name to Show/Hide
								  szBtnSpanName	- Button to Show/Hide
								  Formname		- Form Name
								  szFlag		- Flag variable, to determine the span should be shown
		Author                  : Balaji. V
		Purpose                 : This function is used for People's Choice.
								  To show/hide the Script Area on each form
		Creation Date           : 27 March 2002
		Last Modified Date      : 27 March 2002
		------------------------------------------------------------------------*/
		function ScriptOnOff(szSpanName, szBtnSpanName, Formname, szFlag)
		{				
			if (eval(szSpanName))
			{
				if (szFlag == "0")
				{
					eval(szSpanName).style.display = "none";
					eval(szBtnSpanName+'Off').style.display = "";
					eval(szBtnSpanName+'On').style.display = "none";
				}
				else
				{
					eval(szSpanName).style.display = "";
					eval(szBtnSpanName+'Off').style.display = "none";
					eval(szBtnSpanName+'On').style.display = "";
				}
				eval("document."+Formname+".hidCSRFlag").value = szFlag;
			}
		}
		
	/*	This function basically asks the user to install the MICR,if it is not available in the system.
	This function was existing in three files of REPORTS and are being shifted
	to ClientValidation.js
	
	1) CarrierCriteriaListCommit_rpt.asp
	2) CarrierCriteriaListPreview_rpt.asp
	3) CarrierCriteriaList_rpt.asp */
		
   function checkIfInstalled(fname)
{
   loaded = document.readyState == "complete";
   teststr = "MICR Font is Not Installed"
   if(!window.fntLyr0)
   {
      lyrstr0 = "<SPAN ID=fntLyr0 STYLE='position:absolute;width:60;font:12pt Courier'>"+ teststr +"</SPAN>";
      lyrstr1 = "<SPAN ID=fntLyr1 STYLE='position:absolute;width:60;font-size:12pt'>"+ teststr +"</SPAN>";
      if (loaded) 
      {
         document.body.insertAdjacentHTML("BeforeEnd",lyrstr0);      
         document.body.insertAdjacentHTML("BeforeEnd",lyrstr1);
      }
      else 
      {
         document.write(lyrstr0);
         document.write(lyrstr1);
      }
   }
   fntLyr1.style.fontFamily = fname +",Courier";
   width0 =  fntLyr0.offsetWidth;
   width1 =  fntLyr1.offsetWidth ;
   fntLyr0.style.display = "none";
   fntLyr1.style.display = "none";
   return (width0 != width1);
}

	/*
		Added by Piyush on 15 Apr 2002
		To check for the Proper Month Begining Date
	*/
	function CheckForProperMonth(szMonthNewDate, szTransDate)
	{
		//Check for Null Beg. Month Date - Added By Ravi on 15 Apr 2002
		if (trimTheString(szMonthNewDate) == "")
			return true;
		szMonthNewDate = new Date(szMonthNewDate);
		szTransDate = new Date(szTransDate)
		var szMonthNewDateMnth = szMonthNewDate.getMonth();
		var szTransDateMnth = szTransDate.getMonth();
		var szMonthNewDateYr = szMonthNewDate.getYear();
		var szTransDateYr = szTransDate.getYear();
		if (szTransDateMnth != szMonthNewDateMnth)
			return false;
		else if (szTransDateYr != szMonthNewDateYr)
			return false;
		else
			return true;
	}

