﻿var regexEnum = 
{
	intege:"^([+-]?)\\d+$",					//整数
	intege1:"^([+]?)\\d+$",					//正整数
	intege2:"^-\\d+$",						//负整数
	num:"^([+-]?)\\d*\\.?\\d+$",			//数字
	num1:"^([+]?)\\d*\\.?\\d+$",			//正数
	num2:"^-\\d*\\.?\\d+$",					//负数
	decmal:"^([+-]?)\\d*\\.\\d+$",			//浮点数
	decmal1:"^([+]?)\\d*\\.\\d+$",			//正浮点数
	decmal2:"^-\\d*\\.\\d+$",				//负浮点数
	email:"^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", //邮件
	color:"^#[0-9a-fA-F]{6}$",				//颜色
	url:"^http[s]?:\\/\\/([\\w-]+\\.)+[\\w-]+([\\w-./?%&=]*)?$",	//url
	chinese:"^[\\u4E00-\\u9FA5\\uF900-\\uFA2D]+$",					//仅中文
	ascii:"^[\\x00-\\xFF]+$",				//仅ACSII字符
	zipcode:"^\\d{6}$",						//邮编
	mobile:"^(13|15)[0-9]{9}$",				//手机
	ip4:"^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5]).(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5]).(d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5]).(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$",				//ip地址
	notempty:"^\\S+$",						//非空
	picture:"(.*)\\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)$",	//图片
	rar:"(.*)\\.(rar|zip|7zip|tgz)$",								//压缩文件
	date:"^\\d{4}(\\-|\\/|\.)\\d{1,2}\\1\\d{1,2}$",					//日期
	qq:"^[1-9]*[1-9][0-9]*$",				//QQ号码
	tel:"(\\d{3}-|\\d{4}-)?(\\d{8}|\\d{7})",	//国内电话
	username:"^\\w+$",						//用来用户注册。匹配由数字、26个英文字母或者下划线组成的字符串
	letter:"^[A-Za-z]+$",					//字母
	letter_u:"^[A-Z]+$",					//大写字母
	letter_l:"^[a-z]+$",					//小写字母
	idcard:"^[1-9]([0-9]{14}|[0-9]{17})$"	//身份证
}

String.prototype.Trim = function(){return this.replace(/^\s+|\s+$/g,"");}
String.prototype.Ltrim = function(){return this.replace(/^\s+/g, "");}
String.prototype.Rtrim = function(){return this.replace(/\s+$/g, "");}

function $(id) {
	return document.getElementById(id);
}

function CheckByRegExp(regexName,text){
    var reg = new RegExp(regexName);
    return reg.test(text.Trim().Ltrim().Rtrim().replace(/\s+/,""));
}

// 显示无模式对话框
function ShowDialog(url, width, height) {
	return window.showModalDialog(url,"", "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
}

//检查是否只含有空格(验证表单提交)
function CheckSpace(checkStr) {
  var str = '';
  for(i = 0; i < checkStr.length; i++) {
    str = str + ' ';
  }
  return (str == checkStr);
}


function ss(i){
	ssid=$("small"+i);
	
	if(ssid.style.display=="none"){
		ssid.style.display="";
		}
	else if(ssid.style.display==""){
		ssid.style.display="none"
		}
	
	}

