/**************Checks for percentage at key press event***************/
function checkPercentage(evt, field)
{
	charCode = evt.keyCode;
	 
	if(charCode==37)
	{
	alert("Percentage character not allowed!");
	evt.keyCode= null;  
	return false;
	}
}


/***************************************************************
* Function: toUpperCaseSTR(Object)  								   
* Description: This function will check for a valid Application #
****************************************************************/  
function toUpperCaseSTR(object)  
{	  
     object.value = object.value.toUpperCase();
	 return ;
}  

/***************************************************************
* Function: isValidApplID(num)  								   
* Description: This function will check for a valid Application #
****************************************************************/  
function isValidApplID(num)  
{	  
        if (num.length < 8 || !isValidInt(num))
		{
             return false;
		}
	 return true;
}  


/***************************************************************
* Function: isValidFloat(num)								   
* Description: This function will check for a valid Float
****************************************************************/
function isValidFloat(num)
{	  
       var valid = "0123456789.";
	var temp;
	for (var i = 0; i < num.length; i++)
		{
		temp = num.substring(i, i + 1);
		if (valid.indexOf(temp) == "-1")
		{
		
		return false;
		}
	}
	return true;
}  
/***************************************************************
* Function: isValidInt(num)								   
* Description: This function will check for a valid Integer
****************************************************************/
function isValidInt(num)
{   
 	var valid = "0123456789";
	var temp;
	for (var i = 0; i < num.length; i++)
		{
		temp = num.substring(i, i + 1);
		if (valid.indexOf(temp) == "-1")
		{
			return false;
			}
	}
	return true;	  
		 
}

/***************************************************************
* Function: isValidPhoneNumber(num)								   
* Description: This function will check for a valid PhoneNumber
****************************************************************/
function isValidPhoneNumber(num)
{	    
	     
		if (num.length <10 || !isValidNumber(num))
			{
				return false; 
			}
		 
    return true; 
}

/***************************************************************
* Function: isValidZipCode(num)								   
* Description: This function will check for a valid Zipcode
****************************************************************/
function isValidZipCode(num)
{
	    
		if (num.length < 5 || !isValidNumber(num))
			{
				return false; 
			}
		 
    return true; 
}

/***************************************************************
* Function: isValidLimit(num,limit)								   
* Description: This function will check for a valid limit
****************************************************************/
function isValidLimit(num,limit)
{
	 
		if (num < 0 || num > limit)
			{
				return false; 
			}
		 
    return true; 
}

/***************************************************************
* Function: isValidFieldLimit(field,limit)								   
* Description: This function will check for a valid limit
****************************************************************/
function isValidFieldLimit(field,limit)
{
	 
		if (field.value.length < 0 || field.value.length > limit)
			{	field.focus();
				return false; 
			}
		 
    return true; 
}

/***************************************************************
* Function: trim(str)								   
* Description: This function will trim the spaces in a string
****************************************************************/
function  trim(str)
{ 
  var startingPos=-1;
  var endPos=-1; 
  var strLength = str.length;
  for(var i=0;i<strLength;i++)
   {
	 if(startingPos == -1 && str.charAt(i) != ' ')
        {
        startingPos=i;
	 }
       if(endPos == -1 && str.charAt((strLength-i)) != ' ')
        {
        endPos=strLength-i;
	 }
	if(startingPos > -1 && endPos > -1)
	{
	 return str.substring(startingPos,endPos);
	}
 
  }

return "";
 }	  
 
 function y2k(number)
 { return (number < 1000) ? number + 1900 : number; }
/**/
var today = new Date();
var day   = today.getDate();
var month = today.getMonth();
var year  = y2k(today.getYear());
/**/


/***************************************************************
* Function: getCurrentDate()								   *
* Description: This returns current date in mm/dd/yyyy format. *
****************************************************************/
function getCurrentDate()
 {
 var today = new Date();
 var day   = today.getDate();
 var month = today.getMonth() + 1;
 var year  = y2k(today.getYear());

 if ( month <=  9)
    {month = "0" + month;}

 if (day <= 9)
    {day  = "0" + day;}

 var mydate =  month + "/" + day + "/" + year;
 return mydate;
 }

/***************************************************************
* Function: validateEmail(emailStr)							   *
* Description:												   *
****************************************************************/
 <!-- Begin
function validateEmail(emailStr) {

/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("The username doesn't seem to be valid.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}

//  End -->

function isValidNumber(num)
{
    var valid = "0123456789";
	var temp;
	for (var i = 0; i < num.length; i++)
		{
		temp = num.substring(i, i + 1);
		if (valid.indexOf(temp) == "-1")
		{
			return false;
			}
	}
	return true;

}

 
  
/***************************************************************
* Function: getFormPos(formName)                                                                                                                             *
* Description: will get form number                                                                                                                              *
****************************************************************/
function getFormPos(formName)
{
	for (var i = 0; i < document.forms.length; i++)
	{
		if (formName == document.forms[i].name)
		{
			return i;
		}
	}
}
/****************************************************************
* Function: getElementPos(formNo, elementName)                                                                                                 *
* Description: will get element position within the given form                                                                               *
*****************************************************************/
function getElementPos(formNo, elementName)
{
	 
	for (var i = 0; i < document.forms[formNo].length; i++)
	{
		if (elementName == document.forms[formNo].elements[i].name)
		{
			return i;
		}
	}
}
/****************************************************************
* Function: setDropDownIndex(formPos, elementPos, selField)                                                                          *
* Description: will set index for a drop down                                                                                                             *
****************************************************************/
function setDropDownIndex(formPos, elementPos, selField)
{
	var selected_dep_index = 0;
	var checked = false;
	 
	for (var j = 0; j < window.document.forms[formPos].elements[elementPos].length; j++)
	{
		if (selField == window.document.forms[formPos].elements[elementPos].options[j].value)
		{
			selected_dep_index = j;
			checked = true;
			break;
		}
	}
	if (checked)
	{
		window.document.forms[formPos].elements[elementPos].selectedIndex = selected_dep_index;
	}
	else
	{
		window.document.forms[formPos].elements[elementPos].selectedIndex = 0;
	}
}
/*******************************************************************
* Function: setDropDown(formName, elementName, selField)                                                                             *
* Description: will set index for a drop down for given element                                                                            *
********************************************************************/
function setDropDown(formName, elementName, selField)
{	
	var selected_dep_index = 0;
	var checked = false;
	var tempObj = eval("window.document."+formName+"." +elementName);
	for (var j = 0; j < tempObj.length; j++)
	{
		if (selField == tempObj.options[j].value)
		{
			selected_dep_index = j;
			checked = true;
			break;
		}
	}
	if (checked)
	{
		tempObj.selectedIndex = selected_dep_index;
	}
	else
	{ 
		tempObj.selectedIndex = 0;
	} 
}
/*******************************************************************
* Function: setDropDown(formName, elementName, selField)                                                                             *
* Description: will set index for a drop down for given element                                                                            *
********************************************************************/
function setDropDownInParent(formName, elementName, selValue)
{
    
     var selected_dep_index = 0;
	 var checked = false;
	 var tempObj = eval("window.opener.document."+formName+"." +elementName);
	 
	for (var j = 0; j < tempObj.length; j++)
	{
		if (selValue == tempObj.options[j].value)
		{
			selected_dep_index = j;
			checked = true;
			break;
		}
	}
	if (checked)
	{
		tempObj.selectedIndex = selected_dep_index;
	}
	else
	{
		tempObj.selectedIndex = 0;
	}
}

 

/**********************************************************************************
* Function: isGreaterThanToday(givenDate)        *                                                                  *
* Description: This Function will check if given date is greater than today's date								                    *
***********************************************************************************/
function isGreaterThanToday(givenDate)
{
	var today = new Date(); // today
	var valdate = new Date(givenDate); // your launch date
	if (today.getTime() < valdate.getTime()) 
		{  
			 return true;
		}
	return false;	
 }
  
 /**********************************************************************************
 * Function: isGTCurrentDate(givenDate)                 
 * Description: This Function will check if given date is greater than today's date
 ***********************************************************************************/
function isGTCurrentDate(givenDate)
{ 
	if ( new Date(givenDate).getTime() >  new Date(getCurrentDate()).getTime()) 
	 {  
	  return true;
	 }
	return false;	
 }

 /****************************************************************************************
 * Function: isGTECurrentDate(givenDate)               
 * Description: This Function will check if given date is greater or equal to today's date
 *****************************************************************************************/
function isGTECurrentDate(givenDate)
{
	if ( new Date(givenDate).getTime() >=  new Date(getCurrentDate()).getTime()) 
	 {  
	  return true;
	 }
	return false;	
 }

 /****************************************************************************************
 * Function: isGTECurrentDate(givenDate)               
 * Description: This Function will check if given date and time 
   is greater than today's date and time 
 *****************************************************************************************/
function isGTCurrentDateTime(givenDateTime)
{
	if ( new Date(givenDateTime).getTime() >  new Date().getTime()) 
	 {  
	  return true;
	 }
	return false;	
}

 /****************************************************************************************
 * Function: isGTECurrentDateTime(givenDateTime)            
 * Description: This Function will check if given date and time 
   is greater or equal to today's date and time 
 *****************************************************************************************/
function isGTECurrentDateTime(givenDateTime)
{
	if ( new Date(givenDateTime).getTime() >=  new Date().getTime()) 
	 {  
	  return true;
	 }
	return false;	
 }

 /****************************************************************************************
 * Function: isLTCurrentDate(givenDate)         
 * Description: This Function will check if given date  
   is less than  today's date 
 *****************************************************************************************/
function isLTCurrentDate(givenDate)
{ 
	if ( new Date(givenDate).getTime() <  new Date(getCurrentDate()).getTime()) 
	 {  
	  return true;
	 }
	return false;	
 }

 /****************************************************************************************
 * Function: isLTECurrentDate(givenDate)         
 * Description: This Function will check if given date  
   is less than or equal to  today's date 
 *****************************************************************************************/
function isLTECurrentDate(givenDate)
{
	if ( new Date(givenDate).getTime() <=  new Date(getCurrentDate()).getTime()) 
	 {  
	  return true;
	 }
	return false;	
 }

 /****************************************************************************************
 * Function: isLTCurrentDateTime(givenDate)         
 * Description: This Function will check if given date and time 
   is less than  today's date and time
 *****************************************************************************************/
function isLTCurrentDateTime(givenDateTime)
{
	if ( new Date(givenDateTime).getTime() <  new Date().getTime()) 
	 {  
	  return true;
	 }
	return false;	
}

 /****************************************************************************************
 * Function: isLTECurrentDateTime(givenDate)         
 * Description: This Function will check if given date and time 
   is less than or equal to  today's date  and time
 *****************************************************************************************/
function isLTECurrentDateTime(givenDateTime)
{
	if ( new Date(givenDateTime).getTime() <=  new Date().getTime()) 
	 {  
	  return true;
	 }
	return false;	
 }
 
/*****************************************************************************
* Function: Date1GTEDate2(dt1,dt2)                                                                          
* Description: This Function will Compare two Dates for Greater Than or equal		       		 
******************************************************************************/

function Date1GTEDate2(dt1,dt2)    
{

	if (new Date(dt1).getTime() >=  new Date(dt2).getTime())  
	 {  
	  return true;     
	 }
	return false;	
 }

/*****************************************************************************
* Function: Date1GTEDate2(dt1,dt2)                                                                          
* Description: This Function will Compare two Dates for Greater Than or equal		       		 
******************************************************************************/
function Date1LTEDate2(dt1,dt2)    
{

	if (new Date(dt1).getTime() <=  new Date(dt2).getTime())  
	 {  
	  return true;     
	 }
	return false;	
 }
 
/*****************************************************************************
* Function: Date1GTEDate2(dt1,dt2)                                                                          
* Description: This Function will Compare two Dates for Greater Than or equal		       		 
******************************************************************************/
function Date1GTDate2(dt1,dt2)   
{
	if (new Date(dt1).getTime() > new Date(dt2).getTime())  
	 {  
	  return true;     
	 }
	return false;	
 } 
 
/*****************************************************************************
* Function: Date1GTEDate2(dt1,dt2)                                                                          
* Description: This Function will Compare two Dates for Greater Than or equal		       		 
******************************************************************************/
function Date1LTDate2(dt1,dt2)
{
	if (new Date(dt1).getTime() < new Date(dt2).getTime())    
	 {  
	  return true;     
	 }
	return false;	
 } 

/***********************************************************
* Function: compareDate(givenDate)                      *                                            
* Description: This Function will Compare Dates			*		 
************************************************************/

function compareDate(Date1,Date2)    
{
	var DateOne = new Date(Date1); // today
	var Datetwo = new Date(Date2); // your launch date
	

	if( DateOne.getTime() == Datetwo.getTime())
		{
			 return false;  
		}
	 
	if ( DateOne.getTime() <  Datetwo.getTime())  
		{  
			 return true;     
		}
	return false;	
 }
 

 

 
 
/********************************************************************************
* Function: displayPhoneNo(DisPhNo)                                                                       
* Description: This Function will format and display the phone number  		       		 
*********************************************************************************/
function displayPhoneNo(DisPhNo)
{
var DisPhoneNo = "";
if(DisPhNo != "" && DisPhNo.length  == 10)
	{
		DisPhoneNo = "("+DisPhNo.substring(0,3)+")"+DisPhNo.substring(3,6)+"-"+DisPhNo.substring(6,10);
		return DisPhoneNo;
	}
else
	{
		return DisPhNo ;    
	}
}

/*****************************************************************************************
* Function: formatPhoneNo(PhoneNo)                                                                    
* Description: This Function will format and display the phone number for key press event 		       		 
******************************************************************************************/
function formatPhoneNo(PhoneNo)    
{
	PhNo = PhoneNo.value;
	if(PhNo.length == 1)
	{
		PhoneNo.value = "("+PhNo ;
	}
	if(PhNo.length == 4)
	{
		PhoneNo.value = PhNo+")" ;
	}
	if(PhNo.length == 8)
	{
		PhoneNo.value = PhNo+"-" ;
	}
	 
}

/*****************************************************************************************
* Function: mergePhoneNo(PhoneNoObj)                                                                      
* Description: This Function will merge the phone number for submission
******************************************************************************************/
function mergePhoneNo(PhoneNoObj)
{
	var PNo = PhoneNoObj.value;
	 
	if (PNo.indexOf("(") > -1 || PNo.length == 13)
	{
		return PNo.substring(1,4)+PNo.substring(5,8)+PNo.substring(9);
	}
    else if (PNo.indexOf("-") > -1 || PNo.length == 12)
	{       
	  return PNo.substring(0,3)+PNo.substring(4,7)+PNo.substring(8);  
	} 
	else    
	{
		return PNo;
	}
	
 }
function mergePhoneNoForHidden(PNo)
{

 if (PNo != "" && PNo.length == 13)
	{
		return PNo.substring(1,4)+PNo.substring(5,8)+PNo.substring(9,13);
	}
 else 
	{
		return PNo;
	}

}

  

/***********************************************************************************
* Function: logout()                                                                 
* Description: This Function will make the user to exit from the application
***********************************************************************************/
function logout()
{
 if (window.confirm("Want to logout"))
 {
  document.forms[0].action = "";
  document.forms[0].submit();
 }
}



/***********************************************************************************
* Function: isValidateCommentsLen(tempString)                                                                 
* Description: This Function will check for comments less than 1000 chars
***********************************************************************************/
function isValidateCommentsLen(tempString)  
	{
			
		if (tempString.length > 1000)
		{
			return true;    				
		}
		else
		{
			return false;
		}
		
	}

 
 
/*****************************************************************************
* Function: editCheck(fieldToBeEdited,checkField)                                                                
* Description: This Function will check the checkfield to allow editing on
* required field 		       		 
*****************************************************************************/
function editCheck(fieldToBeEdited,checkField)
{
 if(eval("document.forms[0]."+checkField+".checked"))
 {
    eval("document.forms[0]."+fieldToBeEdited+".disabled = false") ;	
 }
 else
 {
   eval("document.forms[0]."+fieldToBeEdited+".disabled = true") ;
 }
}

/*****************************************************************************
* Function: enableField(fieldName)                                                               
* Description: This Function will  enable the given field
*****************************************************************************/
function enableField(fieldName)
{ 
  eval("document.forms[0]."+fieldName+".disabled = false") ;	 
}
/*****************************************************************************
* Function: disableField(fieldName)                                                               
* Description: This Function will  enable the given field
*****************************************************************************/
function disableField(fieldName)
{ 
  eval("document.forms[0]."+fieldName+".disabled = true") ;	 
}
/*****************************************************************************
* Function: editCheck(fieldToBeEdited,checkField)                                                                
* Description: This Function will check the checkfield to allow editing on
* required field 		       		 
*****************************************************************************/
function validateEditing(fieldvalue,checkField)
{ 
 if(fieldvalue.length > 0)
 {
    eval("document.forms[0]."+checkField+".disabled = true") ;	
 }
 else
 {
   eval("document.forms[0]."+checkField+".disabled = false") ;
 }
}

/**********************manadatorty Stars*********************************/

	function showStar(fieldName)
	{
			var mandatoryStar = eval('document.all["'+fieldName+'"].style');
			mandatoryStar.visibility="visible"; 
			 
			
	}
	 
	function hideStar(fieldName)
	{
			var mandatoryStar = eval('document.all["'+fieldName+'"].style');
			mandatoryStar.visibility="hidden";      
	}
	 
	 function printForm()
{
	footertable.style.display="none";
	headertable.style.display="none";
	//tabtable.style.display="none";
	submitTable.style.display="none";
	leftNaviTable.style.display="none";
	//deptTable.style.display="none";
	window.print();
	footertable.style.display="inline";
	headertable.style.display="inline";
	//tabtable.style.display="inline";
	leftNaviTable.style.display="inline";
	//deptTable.style.display="inline";
	submitTable.style.display="inline";    
}
/**************Checks for Integer at key press event***************/
function checkInt(evt, field)
{
 charCode = evt.keyCode;
 

 if(charCode != 13 && (charCode<48  || charCode > 57))
 {
 
 alert("Please enter a number!");
 evt.keyCode= null;  
 
 return false;
 }
 else 
 return true;
}
 /**************Checks for Float at key press event***************/
function checkFloat(evt, field)
{
	evt = (evt) ? evt : event;  

 	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	 
	if((field.value).indexOf(".")!=-1 && charCode==46 && charCode != 13)
	{
	alert("You can only have one decimal point.");
	evt.keyCode= null;  
	return false;
	} 
	  if(!(charCode == 46 || (charCode >= 48  && charCode <= 57) || (charCode == 13)) )
	  { 
	 
	  
	  alert("Please enter a valid number.");
	  evt.keyCode = null;  
	  return false;
	 } 
	 return true;
}

 /**************Checks for TextArea data Length at key press event***************/
function checkCommentsLength(evt,field,commlen)
{ 
		 if (field.value.length >  (commlen-1))  
		 {
		 alert("Exceeded the comment limit(" + commlen +").");
		 evt.keyCode = null;
		 return false;
		 }
		 
		 return true;
} 
/**************Checks for Float Limit at Form Submit***************/
function checkFloatLimit(field,lmt)
{ 
	 var limit = new String(lmt);
	if (field.value.length > 0 && isValidFloat(field.value))
	{
		limitDecimalPos = limit.indexOf(".");
		fieldDecimalPos = field.value.indexOf(".");
		  
		 if(fieldDecimalPos > -1 && ((limit.length-1) - limitDecimalPos) < (field.value.substring(fieldDecimalPos+1)).length)
		 {	 
				alert("Only "+ ((limit.length-1) - limitDecimalPos) +  " digits after decimal point allowed."); 
				field.focus();
				return false;
		 }
		 else if (parseFloat(field.value) < 0 || parseFloat(field.value) > parseFloat(limit))
				{
				alert("Exceeded field limit "+limit);
				field.focus(); 	
				return false; 
				}
	}
	return true; 
} 


function checkQuote(evt)
{
 charCode = evt.keyCode;
  

 if(charCode == 34 || charCode == 39 )
 {
 
 alert("Single quote or  Double quote are not allowed for this field");
 evt.keyCode= null;  
 
 return false;
 }
 else 
 return true;
} 





function escapeAll (thisForm) {
	var tempStr;
	var singleQuote = "'";

	//loop through all "TEXT" & "TEXTAREA" elements on the form...
	for (var i = 0; i < thisForm.length; i++) {
		var thisField = thisForm[i];
		if (thisField.type == "text" || thisField.type == "textarea") {
			tempStr = thisField.value;
			//escape single quotes...
			thisField.value = tempStr.replace(/"/g, singleQuote) ;
			thisField.value = tempStr.replace(/'/g, "''") ;
		}
	}
}

function UnescapeAll (thisForm) {
	var tempStr;
	var singleQuote = "'";

	//loop through all "TEXT" & "TEXTAREA" elements on the form...
	for (var i = 0; i < thisForm.length; i++) {
		var thisField = thisForm[i];
		if (thisField.type == "text" || thisField.type == "textarea") {
			tempStr = thisField.value;
			//Unescape single quotes...
			thisField.value = tempStr.replace(/''/g, singleQuote) ;
		}
	}
}
 

function trimAll (thisForm) {
	var tempStr;

	//loop through all "TEXT" & "TEXTAREA" elements on the form...
	for (var i = 0; i < thisForm.length; i++) {
		var thisField = thisForm[i];
		if (thisField.type == "text" || thisField.type == "textarea") {
			tempStr = thisField.value;
			//escape single quotes...
			thisField.value = trim(tempStr);
		}
	}
}
/***************************************************************
* Function: resetForm(formName)								   
* Description: This function will reset the form
****************************************************************/
function resetForm(formName) { 
   
  
   if (window.confirm('This action will reset the information you have entered.  Click ok or cancel'))
	{
		
		eval("document."+formName+".reset()"); 
		
	}
   
	return ;
}







