//netsChecker version 0.2
function netsChecker(){
	//-- ------ #Rule ------ --
	this.sysRule=new Array();
	//Is number
	this.sysRule[0]=/^\d{0,}$/;
	//Is word
	this.sysRule[1]=/^\w{1,}$/;
	//Is float
	this.sysRule[2]=/^(\d{0,9})\.(\d{0,2})$/;
	//中国电话
	this.sysRule[3]=/^\d{2,}-{0,1}\d{6,}$/;
	//中国手机
	this.sysRule[4]=/^(\d{11})$/;
	//电子邮件
	this.sysRule[5]=/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{1,7}$/;
	//旧/新身份证
	this.sysRule[6]=/^\s*\d{15}\s*$/;
	this.sysRule[7]=/^\s*\d{18}\s*$/;
	//日期
	this.sysRule[8]=/^(\d{4})\-(\d{1}?)\-(\d{1}?)$/;
}
netsChecker.prototype.Filter=function(pSTR,pFilterType){
	var Coun0=0;
	var tmpSTR=pSTR;
	
	if(pFilterType==0){
		tmpSTR=tmpSTR.replace("'","");
	}else if(pFilterType==1){
		tmpSTR=tmpSTR.replace("'","");
		tmpSTR=tmpSTR.replace("script","");
		tmpSTR=tmpSTR.replace("select","");
		tmpSTR=tmpSTR.replace("insert","");
	}
	
	return tmpSTR;
}
netsChecker.prototype.Rule=function(pSTR,pIndex){
	if(this.sysRule.length>pIndex){
		var tmpReg=this.sysRule[pIndex];
		tmpReg.lastIndex=0;
		if(tmpReg.test(pSTR)){
			return true;
		}else{
			return false;
		}
	}
	return true;
}
netsChecker.prototype.CheckLen=function(pSTR,pMinLen,pMaxLen){
	if(parseInt(pSTR.getBytes())>=pMinLen && parseInt(pSTR.getBytes())<=pMaxLen){
		return true;
	}else{
		return false;
	}
}
String.prototype.getBytes = function() {    
    var cArr = this.match(/[^\x00-\xff]/ig);    
    return this.length + (cArr == null ? 0 : cArr.length);    
}
//------ #Demo ------ ------
function jsDCheck(pPara){
	var tmpControl="";
	var tmpError="";
	var tmpChecker=new netsChecker();
	var tmpActionWithOut=document.getElementById("ActionWithOut");
	var Coun0=0;
	//-- ------ #ActionWithOut ------ --
	if(tmpActionWithOut==undefined){
		return true;
	}
	if(tmpActionWithOut.value=="1"){
		return true;
	}else if(tmpActionWithOut.value=="2"){
		return false;
	}
	//-- ------ #Check ------ --
	/*
	//#uitName
	tmpCheckCont=document.getElementById("uitNameTxt");
	tmpCheckCont.value=tmpChecker.Filter(tmpCheckCont.value,0);
	if(!tmpChecker.CheckLen(tmpCheckCont.value,5,32)){
		Coun0++;
		tmpError+=Coun0+".登陆用户名必须大于5位"+sysSPLIT8;
	}
	*/
	//-- ------ #Result ------ --
	if(Coun0>0){
		tmpSTR="对不起，您提交的内容存在以下错误:"+sysSPLIT8+tmpError;
		showMessage("系统消息 - unionNets.com",tmpSTR,"","0");
		return false;
	}else{
		return true;
	}
}
