function setradio()
{
  document.all.trUpload.style.display = "none";
  document.all.trViruscptsystem.style.display = "";
  document.all.trViruspatch.style.display = "";
  document.all.trVirussoft.style.display = "";
  document.all.trVirusdescrib.style.display = "";
}
function radio1click()
{
  document.all.trUpload.style.display = "";
  document.all.trViruscptsystem.style.display = "none";
  document.all.trViruspatch.style.display = "none";
  document.all.trVirussoft.style.display = "none";
  document.all.trVirusdescrib.style.display = "none";

}
function radio2click(id)
{
  document.all.trUpload.style.display = "none";
  document.all.trViruscptsystem.style.display = "";
  document.all.trViruspatch.style.display = "";
  document.all.trVirussoft.style.display = "";
  document.all.trVirusdescrib.style.display = "";

}
function radio3click(id)
{
  document.all.trUpload.style.display = "none";
  document.all.trViruscptsystem.style.display = "";
  document.all.trViruspatch.style.display = "";
  document.all.trVirussoft.style.display = "";
  document.all.trVirusdescrib.style.display = "";

}
function radio4click(id)
{
top.location="htm/wsbj2/SmsAlarm.asp";
}
function radio5click(id)
{
  document.all.trUpload.style.display = "none";
  document.all.trViruscptsystem.style.display = "none";
  document.all.trViruspatch.style.display = "none";
  document.all.trVirussoft.style.display = "none";
  document.all.trVirusdescrib.style.display = "none";
}
function trimSpace(str)
{
  var i,j;
  if(str == "") return "";
  for(i=0;i<str.length;i++)
    if(str.charAt(i) != ' ') break;
  if(i >= str.length) return "";

  for(j=str.length-1;j>=0;j--)
    if(str.charAt(j) != ' ') break;

  return str.substring(i,j+1);
}
function pad(time)
{
	return (time<10)?("0"+time):time;
}
function setsysdate()
{
	var now=new Date();
	var year=now.getYear();
	var month=now.getMonth()+1;
	var date=now.getDate();
	var hour=now.getHours();
	var min=now.getMinutes();
	var sec=now.getSeconds();

	document.all.YearOfTakePlace.value = year;
	document.all.MonthOfTakePlace.value = pad(month);
	document.all.DayOfTakePlace.value = pad(date);
	document.all.HourOfTakePlace.value = pad(hour);
	document.all.MinOfTakePlace.value = pad(min);
	document.all.SecOfTakePlace.value = pad(sec);
}
function allsubmit() { document.all.submit(); }
function IsDigit(cCheck) { return (('0'<=cCheck) && (cCheck<='9')); }
function IsAlpha(cCheck) { return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) }

function VerifyInput()
{
    strDescrib = document.all.Describ.value;
    if (trimSpace(strDescrib).length == 0)
    {
        alert("请输入事故简单描述");
        document.all.Describ.focus();
        return false;
    }

    //检查举报人姓名的输入是否正确
    strName = document.all.Name.value;
    if (trimSpace(strName).length == 0)
    {
        alert("请输入举报人姓名。");
        document.all.Name.focus();
        return false;
    }

    if (strName.length <= 1)
    {
        alert("用户名长度太短，请选择两位以上的用户名。");
        document.all.Name.focus();
        return false;
    }
    if (strName.length > 16)
    {
        alert("用户名长度太长");
        document.all.Name.focus();
        return false;
    }
    
    //如果填写了邮编，检查是否六位数字
    strPostcode = document.all.PostCode.value;
    if (trimSpace(strPostcode).length > 0)
    {
    	if (trimSpace(strPostcode).length != 6)
    	{
        alert("请输入六位数字邮编。");
        document.all.PostCode.focus();
        return false;
      }
    
	    for (nIndex=0; nIndex<strPostcode.length; nIndex++)
	    {
	        cCheck = strPostcode.charAt(nIndex);
	
	        if (!IsDigit(cCheck))
	        {
	            alert("邮编只能使用数字。");
	            document.all.PostCode.focus();
	            return false;
	        }
	    }
	    if (strPostcode.charAt(0) != '1')
	    {
	        alert("邮编只能是1开头。");
	        document.all.PostCode.focus();
	        return false;
	    }
    }

    //检查电话
    strTel = document.all.Tel.value;
    if (trimSpace(strTel).length == 0)
    {
        alert("请输入联系电话。");
        document.all.Tel.focus();
        return false;
    }
    if (strTel.length > 11 || strTel.length < 8)
    {
        alert("请输入8－11位长度的电话号码");
        document.all.Tel.focus();
        return false;
    }
    for (nIndex=0; nIndex<strTel.length; nIndex++)
    {
        cCheck = strTel.charAt(nIndex);

        if (!IsDigit(cCheck))
        {
            alert("联系电话只能使用数字。");
            document.all.Tel.focus();
            return false;
        }
    }
    
    //如果侵害类型是病毒/黑客入侵，检查异常描述
    if ((document.all.Kind[1].checked) || (document.all.Kind[2].checked))
    {
    	strVirusdescrib = document.all.virusdescrib.value;
    	if (trimSpace(strVirusdescrib).length == 0)
    	{
    		alert("请输入异常现象的描述");
        document.all.virusdescrib.focus();
    		return false;
    	}
    }
    
    return true;
}
function Upload1()
{
	window.open("htm/wsbj2/upload1.asp?F_Type=1","Upload","left=100,top=50,width=400,height=280,status=1");
}
