<!--

/* 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)
}

/**
 * @author:			Wing Siu
 * @date:			2004-10-08
 * @param:			url as string ~ http://www.test-domain.com/testpage.html
 *					name as string ~ name of the just opened browser
 *					width as integer ~ width of the just opened browser
 *					height as integer ~ height of the just opened browser
 *					feature as string ~ feature of the just opened browser
 *					is_central as boolean ~ indicate the new browser located in the center of browser
 * @description:	open a new browser and located at the center of the user's monitor.
 */
function openBrowser(url, name, width, height, feature, is_central){
	var isIE	= (document.all ? true : false);				//@ is Internet Explorer
	var isNS	= (document.layer ? true : false);				//@ is Netscape Navigator 4
	var isDOM	= (document.getElementById ? true : false);		//@ is Netscape Navigator 6+ or other
	var browser	= new Object();
	var browserAttribute	= "";

	if (!browser.win || (browser.win && browser.win.closed)){
		browser.url		= url;
		browser.name	= name;
		browser.width	= width;
		browser.height	= height;

		//-- centerized the opened broswer and initial its attribute if necessary
		if (is_central) {
			if (isIE || isDOM){
				browser.left	= (screen.width - browser.width) / 2;
				browser.top		= (screen.height - browser.height) / 2;
				browserAttribute = "left=" + browser.left + ",top=" + browser.top + ",resizeable=no,width=" + browser.width + ",height=" + browser.height + "," + feature;
			} else if (isNS){
				browser.left	= window.screenX + ((window.outerWidth - browser.width) / 2);
				browser.top		= window.screenY + ((window.outerHeight - browser.height) / 2);
				browserAttribute = "screenX=" + browser.left + ",screenY=" + browser.top + ",resizeable=no,width=" + browser.width + ",height=" + browser.height + "," + feature;
			}
		} else {
			browserAttribute = "resizeable=no,width=" + browser.width + ",height=" + browser.height + "," + feature;
		}

		//-- open new browser
		browser.win = window.open (browser.url, browser.name, browserAttribute);
	}

	browser.win.focus();

	return browser;
}

function getWordLength(text_string){
	var charCount = 0;
	var charPosition = 0;
	for (charPosition = 0; charPosition < text_string.length; charPosition++){
		// @ The ASCII of English and Numeric is less then 256
		// @ if less than 256, add 1, otherwise, add 2
		(text_string.charCodeAt(charPosition) >= 256) ? charCount += 2 : charCount++;
	}

	return charCount;
}
//-->
