var wrong="<image src='images/cuowu.jpg' />";
var right="<image src='images/zhengque.jpg' />";
var flag=false;
function _$(id)
{
  return document.getElementById(id);
}


function checkInt1(strFieldName,lastFile,strLabel,strMinLen,strMaxLen,strExcludedStr)
{	
   var s1=_$(strFieldName);
   var val=s1.value;
   var s2=_$(lastFile);
   if(val.length<strMinLen||val.length>strMaxLen)
   {
	   if(strMinLen==strMaxLen)
	   {
		  s2.innerHTML=wrong+strLabel+"必填或过长";
		  return false;
		}
	 s2.innerHTML=wrong+strLabel+"需在"+strMinLen+"-"+strMaxLen;
	 return false;
	}else
	{
		s2.innerHTML=right+strLabel+"格式正确";
	 return true;
	}
	
}

function checkEmail(val)
{
   var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; 
   if(!myreg.test(val)) 
   {
	  return false
    }
  return true;
		  
	 
}

function checkTel(val)
{
	var regex =/^(13+\d{9})|(159+\d{8})|(153+\d{8})|(158+\d{8})$/;
	if(!regex.test(val))
	{
	  return false;
	}
	return true;
}

function checkUserName(str1,str2,lable)
{
   	var s1=_$(str1);
    var val=s1.value;
    var s2=_$(str2);
	if(val.length<=0||val.length>80)
	{
	   s2.innerHTML=wrong+lable+"必填或过长";	
	   
	 }else
	 {
	   if(checkEmail(val)||checkTel(val))
	   {
		   s2.innerHTML=right+lable+"填写正确";
		 }else
		 {
			 s2.innerHTML=wrong+lable+"格式错误";
		 }
	   
	   }
   
}