// JavaScript Document
function trim(sTemp) {
	// trim leading and trailing spaces for a string
	var regLeftBlanks = /\b[\w\W]+/;
	var regRightBlanks = /\s+$/;
	var regAllBlanks = /^\s+$/;
	var iLeftPos = -1;
	var iRightPos = -1;

	sTemp = sTemp.toString();
	// alert("The string is = *" + sTemp + "*");
	if (sTemp.length == 0) {
       	// empty string, do nothing
	    return "";
	}
	if (sTemp == null) {
		// null string, return 0 length string
		return "";
	}
	if (sTemp.match(regAllBlanks)) {
		// all blanks, return 0 length string
		return "";
	}
	iLeftPos = sTemp.search(regLeftBlanks);
	iRightPos = sTemp.search(regRightBlanks);

	if (iRightPos == -1) {
		iRightPos = sTemp.length;
	}

	return (sTemp.substring(iLeftPos, iRightPos));

}

function isBlank(_str) {
	if(_str == null)  {
		return true;
	} else {
		if (trim(_str).length == 0) {
			return true;
		} else {
			return false;
		}
	}
}

