/*************************************************
表单验证
*************************************************/
<!--
var CheckForm={
	
	
	Init:function(el)
	{
		for (j = 0; j < el.elements.length; j++)
		{
			var obj=el.elements[j]; 
			var name=obj.id.split('_');
			if(name.length<2)continue;
			obj.onchange=function(){CheckForm.exec(this);};
		}
		
	},
	
	Post:function(el)
	{
		for (j = 0; j < el.elements.length; j++)
		{
			var obj=el.elements[j]; 
			var name=obj.id.split('_');
			if(name.length<2)continue;
			if(!this.exec(obj))return false;
		}
	},
	//focus

	//请在这儿修改文件及顔色配?
	RightColor:"#006600",
	WrongColor:"#FF0000",
	Mail:[/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,'电子邮箱地址不符'],
	CN:[/^[\u0391-\uFFE5]+$/,'请使用中?],
	IDCard:[/^\d{15}(\d{2}[A-Za-z0-9])?$/,'格式不对'],
	QQ:[/^[1-9]\d{4,9}$/,'?位以上数字组?],
	Mobile:[/^1\d{10}$/,'手机号格式不?正确的为?**********'],
	Phone:[/^\d{2,4}\-?\d{6,8}$/,'电话号码格式错误,正确的为?**-********'],
	Money:[/^\d+\.?\d{0,2}$/,'格式不对,只能使用数字.数字'],
	Icbc:[/^\d{19}$/,'请输?9位工商银行卡?],
	//Url:/^[a-zA-z]+:\/\/(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$/,
	
	exec:function(el)
	{
		var name=el.id.split('_');
		if(el.value.trim()=="")
		{
		    this.Msg(name[0],'请输入数?,this.WrongColor);
		    return false;
		}

		var items=eval("this."+name[1]);
		el.value=el.value.trim();
		//document.getElementById(name[0]+'_Msg').innerHTML = items[0].test(el.value) ?  '输入格式正确? : items[1];
		if(items[0].test(el.value))
		{
		    this.Msg(name[0],'输入格式正确',this.RightColor);
		    return true;
		}else
		{
		    this.Msg(name[0],items[1],this.WrongColor);
		    return false;
		}

	},
	
	Msg:function(id,info,color)
	{
		document.getElementById(id+'_Msg').innerHTML = info;
		document.getElementById(id+'_Msg').style.color = color;
	},
	PassWD:function(el)
	{
		var msg=['请使?位以上字符做为密?,'字符长度满足'];
		document.getElementById('Password_Msg').innerHTML= el.value.length<5 ? msg[0] : msg[1];
		document.getElementById('Password_Msg').style.color= el.value.length<5 ? this.WrongColor : this.RightColor;
		
		var bColor=['#B48B8B','#B4A78B','#91B48B'];
		for(var i=0;i<3;i++){document.getElementById('pw'+i).style.backgroundColor=bColor[i];}
		var eColor=['#EF5050','#EFBB50','#68EF50'];
		var reg=[/\w/g,/\d/g,/\W/g]; //字符正则数字正则其它正则
		
		var d=el.value.search(/\d/g);
		var w=el.value.search(/[a-zA-Z]/g);
		var o=el.value.search(/\W/g);
		if(o!=-1)
			document.getElementById('pw2').style.backgroundColor=eColor[2];
		else if(w!=-1 && d !=-1)
			document.getElementById('pw1').style.backgroundColor=eColor[1];
		else
			document.getElementById('pw0').style.backgroundColor=eColor[0];
	},
	PassWDAgent:function(el)
	{
		if(document.getElementById('Password').value.length<5)return;
		document.getElementById('Password_Msg').innerHTML= (el.value!=document.getElementById('Password').value) ?  "密码不相? : '密码通过验证';
		document.getElementById('Password_Msg').style.color=  (el.value!=document.getElementById('Password').value) ? this.WrongColor : this.RightColor;
	}
};
	
