<!--
/**
 * @author		Wing Siu
 * @date		2005-06-28
 * @description	value-added function for String prototype
 */
 
/* trim the leader and tailer space */
String.prototype.trim = function() {
	return this.replace(/^\s*/,"").replace(/\s*$/,"");
}


/* remove any space in the string so as to determine the string is empty or not */
String.prototype.isempty = function() {
	var bEmpty = false;

	bEmpty = (this.replace(/ /g, "").length == 0) ? true : false;
	return (bEmpty)
}

/* get the length of the String */
String.prototype.getlen = function() {
	var charCount = 0;
	var charPosition = 0;

	for (charPosition = 0; charPosition < this.length; charPosition++){

		// @ The ASCII of English and Numeric is less then 256
		// @ if less than 256, add 1, otherwise, add 2 (suppose it is Chinese or other country's language)
		(this.charCodeAt(charPosition) >= 256) ? charCount += 2 : charCount++;
	}

	return charCount;
}

/* determine the pressed keycode is numeric */
String.prototype.isnumeric = function (keyCode){

	//-- between 0 - 9, 48 = 1, 57 = 0
	if (keyCode >= 48 && keyCode <= 57){
		return true;
	} else{
		return false;
	}
}
//-->