function check(){
//------------------------------------------------------------
if(document.form1.captcha_anwser.value==null||document.form1.captcha_anwser.value==""){
	alert("验证码不能为空");
	return false;
}
//------------------------------------------------------------ 
if(document.form1.Title.value.length > 100){
	alert("标题：长度超过限制\n\n当前长度: "+form1.Title.value.length+" 字符\n系统允许: 100 字符");
	document.form1.Title.focus();
	return false;
}
//------------------------------------------------------------
if(document.form1.Content.value.length > 500){
	alert("内容：长度超过限制\n\n当前长度: "+form1.Content.value.length+" 字符\n系统允许: 500 字符");
	document.form1.Content.focus();
	return false;
}	
//------------------------------------------------------------
if(document.form1.Departid.value=="0")
  {
        alert("请选择被反映单位"); 
        return false;
  }
//------------------------------------------------------------
if(document.form1.Type.value=="0")
  {
        alert("请选择被投诉类型");
        return false;
  }
//------------------------------------------------------------
flag=0;
for(i=0;i<document.all.IsGrantP.length;i++)
  {
    if(document.all.IsGrantP[i].checked)
	  {
            flag=1;
	  }
  }
if(flag==0)
  {
        alert("请选择是否被选登");
        return false;
  }

  //------------------------------------------------------------
if(document.form1.Name.value=="")
  {
        alert("请填写姓名");
		document.form1.Name.select();
        return false;
  }
if(document.form1.Name.value.length > 6)
{
      alert("姓名长度不能超过6字符,请确认!");
      document.form1.Name.select();
      return false;
}
  //------------------------------------------------------------
if(document.form1.Tel.value=="")
  {
        alert("请填写联系电话");
		document.form1.Tel.select();
        return false;
  }
  if(document.form1.Tel.value.search("^[0-9]*[1-9][0-9]*$"))
	   		  {
                    alert("电话号码包含非法字符");
                    document.form1.Tel.focus();
                    return false;  
              }
//------------------------------------------------------------
  if(document.form1.Title.value=="")
    {
          alert("请填写投诉标题");
  		document.form1.Title.select();
          return false;
    }
//------------------------------------------------------------
if(document.form1.Content.value=="")
  {
        alert("请填写投诉内容");
        document.form1.Content.select();
        return false;
  } 
//------------------------------------------------------------
if(document.form1.MOBILE.value!="")
  {
    if(document.form1.MOBILE.value.length!=11)
	  {
	        alert("手机号码位数有误");
            document.form1.MOBILE.focus();
            return false;  
      }
	else
	  {
	        if(document.form1.MOBILE.value.search("^[0-9]*[1-9][0-9]*$"))
	   		  {
                    alert("手机号码包含非法字符");
                    document.form1.MOBILE.focus();
                    return false;  
              }
            else
			  {
	                var sm = document.form1.MOBILE.value.substring(0,3);
	                var smtag = 0;
	                //switch(sm)
			  		  //{
	                		
					        //case "130":smtag = 0;break;
							//case "131":smtag = 0;break;  
							//case "132":smtag = 0;break;
							//case "133":smtag = 0;break;
							//case "134":smtag = 0;break;
							//case "135":smtag = 0;break;
							//case "136":smtag = 0;break;
							//case "137":smtag = 0;break;
							//case "138":smtag = 0;break;
							//case "139":smtag = 0;break;	 
					 // }
                    if(smtag==1)
					  {
						    alert("不是一个合法的手机号码");
							document.form1.MOBILE.focus();
							return false;
					  }
              }
	  }
  }
//------------------------------------------------------------
if(document.form1.EMAIL.value!="")
  {
	if(checkstring("邮箱地址", document.form1.EMAIL.value, true, 120) < 0)
	  {
            document.form1.EMAIL.focus();
            return false;  
      }
	else
	  {
	        var Priemail=document.form1.EMAIL.value;
            if(Priemail!=null)
            var Pri=Priemail.split(",");
            for(var i=0;i<Pri.length;i++)
			  {
                if(checkemail("邮箱地址", Pri[i], true, 30) < 0)
				  {
                        document.form1.EMAIL.focus();
						document.form1.EMAIL.focus();
                        return false;
				  }
			  }
	   }
  }
//------------------------------------------------------------
if(document.form1.ZIP.value!="")
  {
    if(document.form1.ZIP.value.length!=6)
	  {
	        alert("邮编位数有误");
            document.form1.ZIP.focus();
            return false;  
      }
	else
	  {
	    if(document.form1.ZIP.value.search("^[0-9]*[1-9][0-9]*$"))
		  {
                alert("邮编包含非法字符");
                document.form1.ZIP.focus();
                return false;  
		  }
	  }
  }
//------------------------------------------------------------ 
if(document.form1.Title.value.length > 100){
	alert("标题：长度超过限制\n\n当前长度: "+form1.Title.value.length+" 字符\n系统允许: 100 字符");
	document.form1.Title.focus();
	return false;
}
//------------------------------------------------------------ 
if(document.form1.Content.value.length > 500){
	alert("内容：长度超过限制\n\n当前长度: "+form1.Content.value.length+" 字符\n系统允许: 500 字符");
	document.form1.Content.focus();
	return false;
}
//------------------------------------------------------------ 
if(document.form1.Suggestion.value.length > 500){
	alert("建议：长度超过限制\n\n当前长度: "+form1.Suggestion.value.length+" 字符\n系统允许: 500 字符");
	document.form1.Suggestion.focus();
	return false;
}

}

var dragswitch=0
var nsx
var nsy
var nstemp
function drag_dropns(name){
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}
function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}
var dragapproved=false

function drag_dropie(){
if (dragapproved==true){
document.all.attach.style.pixelLeft=tempx+event.clientX-iex
document.all.attach.style.pixelTop=tempy+event.clientY-iey
return false
}
}

function initializedragie(){
iex=event.clientX
iey=event.clientY
tempx=attach.style.pixelLeft
tempy=attach.style.pixelTop
dragapproved=true
document.onmousemove=drag_dropie
}
if (document.all){
document.onmouseup=new Function("dragapproved=false")
}
function hidebox(){
if (document.all)
attach.style.visibility="hidden"
else if (document.layers)
document.attach.visibility="hide"
}
function showbox(){
if (document.all){
if(attach.style.visibility=="hidden")
attach.style.visibility=""
}
else if (document.layers){
if(document.attach.visibility=="hide")
document.attach.visibility=""
}}

function upload(){
	document.form1.attach1.value=document.form1.filepath1.value;
	document.form1.attach2.value=document.form1.filepath2.value;
	document.form1.attach3.value=document.form1.filepath3.value;
	document.form1.attach4.value=document.form1.filepath4.value;
	document.form1.attach5.value=document.form1.filepath5.value;
	hidebox();
}
