/////
function checkemail(name, data, allowednull)
{
  var datastr = data;
  var lefttrim = datastr.search(/\S/gi);
  
  if (lefttrim == -1) {
    if (allowednull) {
      return 1;
    } else {
      alert("请输入一个正确的E-mail地址！");
      return -1;
    }
  }
  var myRegExp = /[a-z0-9](([a-z0-9]|[_\-\.][a-z0-9])*)@([a-z0-9]([a-z0-9]|[_\-][a-z0-9])*)((\.[a-z0-9]([a-z0-9]|[_\-][a-z0-9])*)*)/gi;
  var answerind = datastr.search(myRegExp);
  var answerarr = datastr.match(myRegExp);
  
  if (answerind == 0 && answerarr[0].length == datastr.length)
  {
    return 0;
  }
  
  alert("请输入一个正确的E-mail地址！");
  return -1;
}



function parseNum(theNum){
  if (theNum.substring(0,1)==0)
    theNum=theNum.substring(1)
  return theNum
}
function parseYMD(theYear,theMonth,theDay) {
  theYear=parseNum(theYear)
  theMonth=parseNum(theMonth)
  theDay=parseNum(theDay)
  if ((theYear < 1900) || (theYear > 3000)){
    return 1
  }
  if (theMonth < 1 || theMonth > 12){
    return 2
  }
  if ((theMonth==1 || theMonth==3 || theMonth==5 || theMonth==7 || theMonth==8 || theMonth==10 || theMonth==12) &&
      (theDay <1 || theDay > 31)
     ){
    return 3
  }
  if ((theMonth==4 || theMonth==6 || theMonth==9 || theMonth==11) &&
      (theDay <1 || theDay > 30)
     ){
    return 3
  }
  if (theYear%400==0 || (theYear%4==0 && theYear%100!=0)){  //闰年
    if (theMonth==2 && (theDay <1 || theDay > 29) )
      return 3
  }
  else  //平年
    if (theMonth==2 && (theDay <1 || theDay > 28) )
      return 3
  return 0
}

function isInvalidDate(theDate,separator){
  default_style=1
  if (theDate.length>10 || theDate.length<8)
    return true
  idx1=theDate.indexOf(separator)
  if (idx1==-1)
    return true
  idx2=theDate.indexOf(separator,idx1+1)
  if (idx2==-1)
    return true
  if (isInvalidDate.arguments.length>2)
  	default_style=isInvalidDate.arguments[2]
  if (default_style<1 || default_style>9){
  	alert("传入参数有误！请检查。")
	return true
  }
  if (default_style==1){
  theYear=theDate.substring(0,idx1)
  theMonth=theDate.substring(idx1+1,idx2)
  theDay=theDate.substring(idx2+1)
  }
  if (default_style==2){
  theMonth=theDate.substring(0,idx1)
  theDay=theDate.substring(idx1+1,idx2)
  theYear=theDate.substring(idx2+1)
  }
  if (theDay.length>2)
    return true
  if (parseYMD(theYear,theMonth,theDay)>0)
    return true
  else
    return false
}
function checkmod()
{
    if(frm.name.value==""){
	alert("姓名不能为空!");
	frm.name.focus();
	return false;
	}
    if (isInvalidDate(frm.area.value,"-")==true){
    alert("请正确填写公司的成立日期（例如:1981-11-12）！");
    frm.area.focus();
    return false;
    }
	if (isNaN(frm.title.value)){
		alert("身份证号码只能填数字！");
		frm.title.focus();		
		    return (false);
    }
	if (frm.title.value==""){
	alert ("身份证号码不能为空");
	frm.title.focus();
	return false
	}
	if ((frm.title.value.length!=15) && (frm.title.value.length!=18 )) {
		alert("请确认您的身份证号码为15位或者18位！");
		frm.title.focus();		
		    return (false);
	}
    if (frm.dw.value=="")
	{alert ("您的所在单位不能为空！");
	frm.dw.focus();
	return false;	
	}
	if (frm.phone.value=="")
	{alert(" 电话号码不能为空!")
	frm.phone.focus();
	return false;
	}
    if (isNaN(frm.phone.value))
	{
    alert(" 电话号码只能为数字");
	frm.phone.focus();
	return false;	
	}
	{
  if (checkemail("电子邮件", document.frm.email.value, false)) {
    document.frm.email.focus();
    return false;   
  }}
	
	
	
		if (frm.bjb.value=="")
	{alert(" 户口所在地不能为空!")
	frm.bjb.focus();
	return false;
	}
		if (frm.address.value=="")
	{alert(" 现 住 址不能为空!")
	frm.address.focus();
	return false;
	}
		if (frm.comment.value=="")
	{alert(" 报警内容不能为空!")
	frm.comment.focus();
	return false;
	}
return true
}

