<!--
//================================================================
// This function returns "true" if the input string contains only
// numeric characters (i.e. 0 - 9), otherwise it return "false".  
//================================================================
function isNumeric(Str) {
   var i = 0, iChar = 0; 
   
   if (Str.length != 0)
   {
     for (i=0; i<Str.length; i++) 
     {
	    iChar = Str.charCodeAt(i);
		if (iChar < 48  ||  iChar > 57) return false; 
     }
     return true; 
   }
   return false; 
} // End of function isNumeric(Str)

//===========================================================================
// This function returns "true" if the input string contains only upper case 
// alphabetic characters (i.e. A-Z), otherwise it return "false".  
//===========================================================================
function isUpperCase(Str) {
   var i = 0, iChar = 0; 
   
   if (Str.length != 0)
   {
     for (i=0; i<Str.length; i++) 
     {
	    iChar = Str.charCodeAt(i);
		if (iChar < 65  ||  iChar > 90) return false; 
     }
     return true; 
   }
   return false; 
} // End of function isUpperCase(Str)

//===========================================================================
// This function returns "true" if the input string contains only upper case  
// or numeric characters (i.e. 0-9 or A-Z), otherwise it return "false".  
//===========================================================================
function isNumericOrUpper(Str) {
   var i = 0, iChar = 0; 
   
   if (Str.length != 0)
   {
     for (i=0; i<Str.length; i++) 
     {
	    iChar = Str.charCodeAt(i);
		if ((iChar >= 48  &&  iChar <= 57) || 
		    (iChar >= 65  &&  iChar <= 90))
		{
		  continue; 
		}
		else 
		{
		  return false; 
		}
     }
     return true; 
   }
   return false; 
} // End of function isNumericOrUpper(Str)

//================================================================ 
// This function gets the specified field from the form "SendCV", 
// and trims, compresses and capitalizes it before returning.
//================================================================ 
function StrTrimCompCap(InStr) {
   var TrimmedStr = "", CompressedStr = "", RetStr = "";
   
   TrimmedStr = TrimString(InStr); 
   if (TrimmedStr != "")
   {
     CompressedStr = StrCompress(TrimmedStr); 
	 RetStr = StrCapitalize(CompressedStr); 
   }
   return RetStr; 
} // End of function StrTrimCompCap(SendCVFieldStr)

//=================================================================
// This function return the input string in a capitalized format, 
// i.e. "tHe CaT sat ON tHe MAT" returns "The Cat Sat On The Mat".
//=================================================================
function StrCapitalize(Str) {
   var RetStr = ""; 
   var LastCharWasSpace = true; 
      
   for (var i=0; i<Str.length; i++) 
   {
	   if (Str.charAt(i) != " ")
	   {
          if (LastCharWasSpace)
          { 
	         RetStr = RetStr + Str.charAt(i).toUpperCase(); 
          }
		  else 
	      { 
	         RetStr = RetStr + Str.charAt(i).toLowerCase(); 
	      }
          LastCharWasSpace = false; 
	    }
		else 
		{
          RetStr = RetStr + " ";
          LastCharWasSpace = true; 
		}
   }
   return RetStr; 
} // End of function StrCapitalize(Str)

//=====================================================================================
// This function trims all occurrances of the supplied character from the input string
//=====================================================================================
function RemoveChar(InputStr, CharToRemove) {
   var RetStr = ""; 

   if (InputStr.length > 0  &&  CharToRemove.length == 1)
   {
     for (var i=0; i<InputStr.length; i++)
	 {
	     if (InputStr.charAt(i) != CharToRemove.charAt(0))
		 {
		   RetStr = RetStr + InputStr.charAt(i); 
		 }
	 } 
   }
   else RetStr = InputStr;
   return RetStr; 
} // End of function RemoveChar(Str)

//=================================================================
// This function returns the input string with any multiple spaces 
// between words removed
//=================================================================
function StrCompress(Str) {
   var word = "", RetStr = "";
   var words = Str.split(" "); 
   for (var i=0; i<words.length; i++) 
   {
      word = TrimString(words[i]); 
	  if (word != "") 
	  {
	    if (i>0) RetStr = RetStr + " " + word;
		else RetStr = word;
	  }  
   }
   return RetStr; 
} // End of function StrCompress(Str) 

//========================================================
// This function returns the input string with any spaces 
// between words removed
//========================================================
function StrCollapse(Str) {
   var word = "", RetStr = "";
   var words = Str.split(" "); 
   for (var i=0; i<words.length; i++) 
   {
      word = TrimString(words[i]); 
	  if (word != "") RetStr = RetStr + word;
   }
   return RetStr; 
} // End of function StrCollapse(Str) 

//======================================================================
// This function returns the input string with all leading and trailing  
// spaces and control characters (e.g. tabs, form feeds, etc.) removed
//======================================================================
function TrimString(Str) {
	var TempStr = "";
	
	if (Str != "")
	{
		TempStr = TrimStringTrail(Str); 
		if (TempStr != "") return TrimStringLead(TempStr); 
		else return ""; // Input string was empty
	}
	else return ""; // Input string was null
	
} // End of function TrimString(Str)

//=================================================================
// This function returns the input string with all trailing spaces 
// and control characters (e.g. tabs, form feeds, etc.) removed
//=================================================================
function TrimStringTrail(Str) {
	var i = 0; 
	
	i = FindLastNonBlankChar(Str); 
	if (i >= 0) return Str.substring(0,i+1); 
	else return ""; // Input string was empty
	
} // End of function TrimStringTrail(Str)

//====================================================================
// This function returns the input string with all leading spaces and 
// control characters (e.g. tabs, form feeds, etc.) removed
//====================================================================
function TrimStringLead(Str) {
	var i = 0; 
	
	i = FindFirstNonBlankChar(Str); 
	if (i >= 0) return Str.substring(i,Str.length); 
	else return ""; // Input string was empty
	
} // End of function TrimStringLead(Str)

//================================================================================
// This function returns the index number of the first character of the input 
// string which is not a space or control character (e.g. tabs, form feeds, etc.), 
// or a value of -1 if the input string is empty.  
//================================================================================
function FindFirstNonBlankChar(Str) {
	var i=0; 
	
	for (var i=0; i<Str.length; i++) 
	{
		 if (Str.charCodeAt(i) > 32) break; // Not space or control character 
	}
	
	if (i < Str.length) return i; 
	else return -1; 
	
} // End of function FindFirstNonBlankChar(Str)

//==================================================================================
// This function returns the index number of the last character of the input string 
// which is not a space or control character (e.g. tabs, form feeds, etc.), or a  
// value of -1 if the input string is empty.  
//==================================================================================
function FindLastNonBlankChar(Str) {
	var i = Str.length; 
	
	while (i > 0) 
	{
		if (Str.charCodeAt(i-1) > 32) break; // Not space or control character
		i = i - 1;   
	} 
	
	return (i - 1); 
	
} // End of function FindLastNonBlankChar(Str)
-->
