// JavaScript Document
document.onmousedown = doMouseDown;
function doMouseDown() {
    if (window.event.button > 3)
		showHelp();
}
function showHelp(){	
	showModalDialog("help.html","","dialogWidth:18;dialogHeight:12;dialogTop:100;dialogLeft:200;status:no;");
}
function infowin(id){	
  open("/info.jsp?id="+id,"","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,left=50,top=50,width=790,height=580");
}
function infowweather(id){	
  open("/weather.jsp?id="+id,"","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,left=50,top=50,width=420,height=310");
}
function checkExp( re, s )
{
	return re.test( s );
}
// 为 String 类增加一个 trim 方法
String.prototype.trim = function()
{
    // 用正则表达式将前后空格用空字符串替代。
    return this.replace( /(^\s*)|(\s*$)/g, "" );
}
// 验证是否 字母数字
function isAlphaNumeric( strValue )
{
	// 只能是 A-Z a-z 0-9 之间的字母数字 并且不为空
	if( isEmpty( strValue ) ) return false;
	return checkExp( /^\w*$/gi, strValue );
}
function isEmail( strValue )
{
	// Email 必须是 x@a.b.c.d 等格式 并且不为空
	if( isEmpty( strValue ) ) return false;
	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
	return checkExp( pattern, strValue );
}
// 验证是否 为空
function isEmpty( strValue )
{
	if( strValue == "" )
		return true;
	else
		return false;
}
// 验证是否 数字
function isNumeric( strValue )
{
	// 数字必须是 0123456789 并且不为空
	if( isEmpty( strValue ) ) return false;
	return checkExp( /^\d*$/g, strValue );
}
// 验证是否 邮政编码
function isPostalCode( strValue )
{
	// 邮政编码必须是6位数字
	return checkExp( /(^$)|(^\d{6}$)/gi, strValue )
}
// 验证是否 URL
function isURL( strValue )
{
	// http://www.yysoft.com/ssj/default.asp?Type=1&ArticleID=789
	if( isEmpty( strValue ) ) return true;
	var pattern = /^(http|https|ftp):\/\/(\w+\.)+[a-z]{2,3}(\/\w+)*(\/\w+\.\w+)*(\?\w+=\w*(&\w+=\w*)*)*/gi;
	return checkExp( pattern, strValue );
}
