<!--
function keyInNumber(){
 //only accept 0-9 or '-' or '.'
 if (event.keyCode >= 48 && event.keyCode <= 48 + 9 || event.keyCode == 45 || event.keyCode == 46)
	event.keyCode = event.keyCode;
 else
	event.keyCode = '';
}

//===format only 2 decimal 
function format2DecCcy( strNum ) {

	var intStartPos;
	
	strNum = Trim(strNum);
	if (strNum == '') return ''; // Not number		

	intStartPos = strNum.indexOf("."); // 2 decimal only

	if ((intStartPos != -1) && (strNum.length - (intStartPos  + 1 ) > 2)){
		return strNum.substr(0,intStartPos  + 3);
	}else
		if (intStartPos == -1) 
			strNum+=".00"
		else
			if (strNum.length - (intStartPos  + 1 ) < 2)
			strNum+="0"
		
	return strNum; // no decimal
}

// 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.
	string += " ";
	
	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;		
	
}

//-->