function trim(inputString) { 
	if (typeof inputString != "string") { return inputString; } 
	var retValue = inputString; 
	var ch = retValue.substring(0, 1); 
	while (ch == " ") {
		retValue = retValue.substring(1, retValue.length); 
		ch = retValue.substring(0, 1); 
	} 
	ch = retValue.substring(retValue.length-1, retValue.length); 
	while (ch == " ") { 
		retValue = retValue.substring(0, retValue.length-1); 
		ch = retValue.substring(retValue.length-1, retValue.length); 
	}
	while (retValue.indexOf(" ") != -1) { 
	retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); 
	} 
	return retValue; 
} 


function onlynumber(){
if (!((event.keyCode>44 && event.keyCode<58)))
   event.keyCode=0;
}

function ShowModalDialog(url) { 
	var iWidth=600; 
	var iHeight=400;
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	window.showModalDialog(url,window,"dialogHeight: "+iHeight+"px; dialogWidth: "+iWidth+"px; dialogTop: "+iTop+"; dialogLeft: "+iLeft+"; resizable: no; status: no; scroll:yes; help: no;");
} 

function ShowModelessDialog(url){
	var iWidth=600; 
	var iHeight=400;
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	window.showModelessDialog(url,window,"dialogHeight: "+iHeight+"px; dialogWidth: "+iWidth+"px; dialogTop: "+iTop+"; dialogLeft: "+iLeft+"; resizable: no; status: no; scroll:yes; help: no;");
}

String.prototype.isEmail = function()
{
        return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(this);
}

 function checkVipLogon(theForm){
	var id = theForm.logon_id.value;
	if(trim(id) == ""){
		alert("Please input you e-mail!");
		theForm.logon_id.focus();
		return(false);
	}
	var pwd = theForm.logon_pwd.value;
	if(trim(pwd) == ""){
		alert("Please input you password!");
		theForm.logon_pwd.focus();
		return(false);
	}
 }

 function checkSearch(theForm){
	var searchKey = theForm.search_key.value;
	if(trim(searchKey) == ""){
		alert("Please input search keyword!");
		theForm.search_key.focus();
		return(false);
	}
 }
