<script LANGUAGE="JavaScript">
<!--
//===Check to validate only 2 decimal
function is3DecCcy( strNum ) {

	var intCounter=0 , intLoop, intStartPos;

	strNum = Trim(strNum);
	if (strNum == '') return false; // Not number
	if (strNum == '.') return false; // Not number

	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // One . only
		if (strNum.charAt(intLoop) == ".") intCounter++;
		if (intCounter > 1) return false;
	}


	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // 0-9, . only
		if (((strNum.charAt(intLoop) < "0") || (strNum.charAt(intLoop) > "9")) &&
				(strNum.charAt(intLoop) != ".")	)
			return false;
	}

	intStartPos = strNum.indexOf("."); // four decimal only
	if (intStartPos != -1){
		if ((strNum.length - (intStartPos  + 1 )) > 3)
			return false;
	}
	return true; // value is 0
}

// eliminate the left and right spaces from the string.
function Trim(string) {
	
	var i;
	var intCount;
	
	
	//truncate the left spaces.
	// 1. get the number of spaces at left side of the string.
	// 2. get the new string without the left spaces.
	
	intCount = 0;
	for (i = 0; i < string.length; i++)
		if ((string.charAt(i)) != " ")
			break;
		else
			intCount = intCount + 1;
		
	string = string.substring(intCount, string.length);
	
		
	
	//truncate the right spaces.
	// 1. use the string that has been truncated just now and get
	//	  the number of spaces on the right side of the string.
	// 2. get the final string and return.
	
	intCount = 0;
	for (i = string.length-1; i >= 0; i--)
		if ((string.charAt(i)) != " ")
			break;
		else
			intCount = intCount + 1;
		
	
	string = string.substring(0, string.length-intCount);	
	return string;		
	
}

//  Returns true if strNum  is only number

function isNumber( strNum ) {

	var intCounter=0 , intLoop;

	strNum = Trim(strNum);

	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // 0-9 only
		if (((strNum.charAt(intLoop) < "0") || (strNum.charAt(intLoop) > "9")
				))
			return false;
	}

	return true; // value is 0
}

//  Returns true if strNum  is alphabet

function isAlphabet( strNum ) {

	var intLoop, strUNum;

	strUNum= strNum.toUpperCase();
	for (intLoop = 0; intLoop < strUNum.length; intLoop++) {
		if (((strUNum.charAt(intLoop) < "A") || (strUNum.charAt(intLoop) > "Z"))
		      && (strUNum.charAt(intLoop) != " ") )
			return false;
	}
	return true;
}

function isAlphaNum( strNum ) {

	var intLoop, strUNum;

	strUNum= strNum.toUpperCase();
	for (intLoop = 0; intLoop < strUNum.length; intLoop++) {
		if ((((strUNum.charAt(intLoop) < "A") || (strUNum.charAt(intLoop) > "Z")) &&
			 ((strUNum.charAt(intLoop) < "0") || (strUNum.charAt(intLoop) > "9")))
		      && (strUNum.charAt(intLoop) != " "))
			return false;
	}
	return true;
}

//  Returns true if strNum  is a number

function isCcy( strNum ) {

	var intCounter=0 , intLoop, intStartPos;

	strNum = Trim(strNum);
	if (strNum == '') return false; // Not number
	if (strNum == '.') return false; // Not number

	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // One . only
		if (strNum.charAt(intLoop) == ".") intCounter++;
		if (intCounter > 1) return false;
	}


	for (intLoop = 0; intLoop < strNum.length; intLoop++) { // 0-9, . only
		if (((strNum.charAt(intLoop) < "0") || (strNum.charAt(intLoop) > "9")) &&
				(strNum.charAt(intLoop) != ".")	)
			return false;
	}

	intStartPos = strNum.indexOf("."); // four decimal only
	if (intStartPos != -1){
		if ((strNum.length - (intStartPos  + 1 )) > 4)
			return false;
	}
	return true; // value is 0
}

function isAnyUpper(strSource){
   var intRow;
   var blnValid;

   blnValid = false;

   for(intRow = 0; intRow < strSource.length; intRow++)
   {
      if ((strSource.charAt(intRow) >= "A") &&
	      (strSource.charAt(intRow) <= "Z"))
	  {
	     blnValid = true;
		 break;
	  }
   }

   return blnValid;
}

function isAnyLower(strSource){
   var intRow;
   var blnValid;

   blnValid = false;

   for(intRow = 0; intRow < strSource.length; intRow++)
   {
      if ((strSource.charAt(intRow) >= "a") &&
	      (strSource.charAt(intRow) <= "z"))
	  {
	     blnValid = true;
		 break;
	  }
   }

   return blnValid;
}

function isAnyNumeric(strSource){
   var intRow;
   var blnValid;

   blnValid = false;

   for(intRow = 0; intRow < strSource.length; intRow++)
   {
      if ((strSource.charAt(intRow) >= "0") &&
	      (strSource.charAt(intRow) <= "9"))
	  {
	     blnValid = true;
		 break;
	  }
   }

   return blnValid;
}

// -->
</script>

