function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall' && e.name !='approveBtn')
       e.checked = form.chkall.checked;
    }
  }

function CheckPassEqual(form)
  {
    if (form.mpassword.value == form.mpassword1.value) return true;
	else alert ("两次输入的密码不一致!");
	return false;
  }

function ConfirmDelUser()
{
  return window.confirm("确定要删除选中的用户？");
}
function ifDel()
{
  return window.confirm("确定要删除？");
}

function ConfirmDelItem()
{
  return window.confirm("确定要删除选中的项目？");
}



function ConfirmDraw()
{
  return window.confirm("确定要撤销？");
}


function ConfirmSendBack()
{
  return window.confirm("确定要退回选中的学生？");
}

function ConfirmReject()
{
  return window.confirm("确定要不批准选中的学生？");
}

function ConfirmUnApprove()
{
  return window.confirm("确定要撤销审批选中的学生？");
}

function ConfirmBatchApprove()
{
  return window.confirm("确定要批量审批选中的学生？");
}

function ConfirmBatchApproveByDirector()
{
  return window.confirm("确定要把选中的学生批量上报局领导？");
}

function confirmSave()
{
  return window.confirm("确定要保存该新增毕业生信息吗？");
}

function countCheckbox()
{
   var i=0,j=0
   var check=formSend.aDel;
   //alert(check.length);
 //  var chkall=formSend.chkall;
   for(;i<check.length;i++)
   {
     if(check[i].checked)
	   { 
         j++;   
 	   }
   }
   if(check.checked) j++;
  formSend.countCheckbox.value=j;
   return j;
}

//代码辅助输入框触发
var lastCodeName;
function openCodeWin(codeName) {
  	if (lastCodeName == null||lastCodeName=='WhereFrom4WaitJob') {
	  	lastCodeName = "WhereFrom";
	}
	eval("document.main.CB" + lastCodeName + ".className='myButton'");
	if(codeName=='WhereFrom4WaitJob')
	{
		eval("document.main.CBWhereFrom" + ".className='myButtonHilight'");
	}
	else
	{
		eval("document.main.CB" + codeName + ".className='myButtonHilight'");
	}
	document.frmCodeInput.location = '/xmpi/code/index.jsp?select=' + codeName;
	CodeTable.style.display = '';
	lastCodeName = codeName;
}

//身份证检测
function CheckIdCard(EdtIdCardNo, EdtBirthYear, EdtBirthMonth, EdtSex)
{
  IdCardNo = EdtIdCardNo.value;
  bErr = true;
  sErr = true;
  BirthYear = "";
  BirthMonth = "";
  iSex = 1;
  
  if (IdCardNo.length != 15 && IdCardNo.length != 18) {bErr = false; sErr = "身份证号码位数不对"; }
  if (IdCardNo.length == 15) {
  	BirthYear = "19" + IdCardNo.substring(6, 8); 
  	BirthMonth = IdCardNo.substring(8, 10) * 1; 
  	iSex = parseInt(IdCardNo.substring(14, 15));
	iSex = (Math.round(iSex / 2) != (iSex / 2) ? 0 : 1);
  }
  else if (IdCardNo.length == 18) {
  	BirthYear = IdCardNo.substring(6, 10); 
  	BirthMonth = IdCardNo.substring(10, 12) * 1; 
  	iSex = parseInt(IdCardNo.substring(16, 17));
	iSex = (Math.round(iSex / 2) != (iSex / 2) ? 0 : 1);
  }
//  	window.alert(BirthYear + "年" + BirthMonth + "月" + iSex);
  EdtBirthYear.value = BirthYear;
  EdtBirthMonth.value = BirthMonth;
  EdtSex.selectedIndex = iSex;

  if (!bErr && sErr != "") {window.alert(sErr); EdtIdCardNo.focus();}
  return (bErr);
}

function checkMobile(form)
{
 	var checkOK = "0123456789";
	var allValid = true;
	var checkStr = form.MobileNum.value;
    if (form.AcceptSMS[0].checked){
    	if (checkStr.length == 11)
	 {
          for (i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
    		for (j = 0;  j < checkOK.length;  j++)
      			{
      		          if (ch == checkOK.charAt(j))
        			break;
        		}
                if (j == checkOK.length)
    	           {
                     allValid = false;	
                     alert("请正确填写手机号码！");  
    	             return false;
    		   }
  	       }
  	}
       else
        {
          alert("手机号码位数不对");  
          return false;    
        }
        if ((checkStr.charAt(0)!=1)||(checkStr.charAt(1)!=3))
        {
          alert("手机号码应该是13×××××××××");  
          return false;    
        }
     }
     else{return true;}       
}

/*
2002-08-29  huangsihai
需求上报
*/
function CheckChkBoxChecked(CheckBoxAry)
 {
   var j =1;
   if (CheckBoxAry == null)
      {//没有记录的时候
        j = 3;
      }
   else
      {     
        if (CheckBoxAry.checked == true)
         {//只有一条记录的时候
	       j = 2;
	      }
         else
          {	
            for (var i=0;i<CheckBoxAry.length;i++)
              {
                if (j==2) continue;
	            if (CheckBoxAry[i].checked == true)
	              {
	                j = 2; 
	              }
                }//for
	          } 
      }	  
	  
  if (j ==2)	 
    {
      return true;
     }
   else
     {
        if (j ==3)
	      {
	        window.alert("没有要处理的信息！");
            return false;
	       }
	      else
	       {  
	         window.alert("请选择要处理的信息！");
             return false;
	       }
       }   
 }

 //commond added by cqc 
function ConfirmDoIt(CheckBoxAry)
{
       if (CheckChkBoxChecked(CheckBoxAry)==true) 
       {
        return window.confirm("确定要这样操作吗？");
       }
     else
       {
        return false;
       } 	
}


function ConfirmDel(CheckBoxAry)
  {
     if (CheckChkBoxChecked(CheckBoxAry)==true) 
       {
        return window.confirm("确定要删除选中的需求信息？");
       }
     else
       {
        return false;
       } 	
   }

function ConfirmSendUp(CheckBoxAry)
 {
  if (CheckChkBoxChecked(CheckBoxAry)==true) 
    { 
      return window.confirm(" 共有 "+countCheckbox()+" 条记录被选中，确定要上报选中的需求信息？");
    }
   else
    {
      return false;
    } 
  }
function ConfirmApprove(CheckBoxAry)
 {
  if (CheckChkBoxChecked(CheckBoxAry)==true) 
    { 
      return window.confirm(" 共有 "+countCheckbox()+" 条记录被选中，确定要审核选中的需求信息？");
    }
   else
    {
      return false;
    } 
  }
  
function ConfirmNeedPub(CheckBoxAry)
  {
    if (CheckChkBoxChecked(CheckBoxAry)==true)
	  {
	   return window.confirm("确定发布选中单位的所有需求信息？");
	  }
	else
	  {
	   return false;
	  }  
  }

  function ConfirmNeedCancelPub(CheckBoxAry)
  {
    if (CheckChkBoxChecked(CheckBoxAry)==true)
	  {
	   return window.confirm("确定撤消发布选中的所有需求信息？");
	  }
	else
	  {
	   return false;
	  }  

   }
     function FormSubmit(FormName)
  {
    FormName.submit();
  }
function popwin(sUrl) {
var win;
win=window.open(sUrl,"","height=360,width=440,scrollbars=yes,resizable=no,toolbar=no,location=no,status=no,menubar=no");
}
//*********判断输入项类型是否合法日期
function isCorrectDate(Number){
     if (Number.length != 8) {
       return false
	 }
     for(var i = 0;i < 8;i++){
       var oneChar = Number.charAt(i)
       if(oneChar < "0" || oneChar > "9"){
         return false
       }
	 }
    if (!isDate(Number)){
      return false
    }else{
      return true
	}
}

//*********判断日期是否合法
function isDate(Number){
      var year = parseFloat(Number.substring(0,4))
      var month = parseFloat(Number.substring(4,6))
      var day = parseFloat(Number.substring(6,8))
      if (month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 2050){
        return false
      }
	  else if ((month == 4 || month == 6 || month == 9 || month ==11) && (day > 30)){
	    return false
	  }
	  else if (isRyear(year) && month == 2 && day > 29 || !isRyear(year) && month == 2 && day > 28){
	    return false
	  }else{
	    return true
	  }
}
//选择回馈，于editByTpc.jsp中
var feedbackMain="";
function choseFeedback()
{  
   var content=document.main.mFeedback.value;
	var prefs = showModalDialog("/xmpi/tpc/localstu/choseFeedback.jsp", feedbackMain,"dialogLeft: 760; dialogTop:270; status: no; dialogWidth:250px; dialogHeight:320px")
	if(prefs)
	{  
	  if(content.indexOf(prefs)<0)
	  {  if(content=="")
    	     content=content+prefs;
		  else
		     content=content+"   "+prefs;
	  }
	}
	feedbackMain=content;
	document.main.mFeedback.value=content;
}
//选择审批意见，于approve.jsp中
var contentMain="";
function choseAdvice()
{  
   var content=document.main.mAppOpi.value;
	var prefs = showModalDialog("choseAdvice.jsp", contentMain,"dialogLeft: 760; dialogTop:270; status: no; dialogWidth:250px; dialogHeight:380px")
	if(prefs)
	{  
	  if(content.indexOf(prefs)<0)
	  {  if(content=="")
    	     content=content+prefs;
		  else
		     content=content+"   "+prefs;
	  }
	}
	contentMain=content;
	document.main.mAppOpi.value=content;
}

//选择审批意见，于choseAdvice.jsp中
function closeme() {
	window.close()
}
// Handle click of OK button
function handleOK() {
	window.returnValue = getFormData()
	closeme()
}
function handleCancel() {
	window.returnValue = ""
	closeme()
}
function initChoseAdvice() {
    var args ="";
	if (window.dialogArguments) 
		args = window.dialogArguments;
	return args;
}
function getFormData() {
    var check=formSend.aDel;
	var content = "";
	var initChose=initChoseAdvice();
	for(var i=0;i<check.length;i++)
	{
	  if(check[i].checked && initChose.indexOf(check[i].value)<0)
	  {  if(content=="")
    	     content=content+check[i].value;
		  else
		     content=content+"   "+check[i].value;
	  }
	}
	return content;
}
//填写选择档案寄存地

function showChoiceHR(){
    var htmlid = " <select name=\"FSUSelect\" onChange=\"putValueHR()\" class=\"myInput\"> ";
        htmlid = htmlid+ "  <option value=''></option> ";
        htmlid = htmlid+ "  <option value='厦门市人才服务中心'>厦门市人才服务中心</option> ";
        htmlid = htmlid+ " <option value='厦门市开元区人才交流咨询服务中心'>厦门市开元区人才交流咨询服务中心</option>";
		htmlid = htmlid+ " <option value='厦门集美区人事劳动和社会保障局'>厦门集美区人事劳动和社会保障局</option>";
		htmlid = htmlid+ "<option value='厦门市思明区人事劳动和社会保障局'>厦门市思明区人事劳动和社会保障局</option>";
		htmlid = htmlid+ "<option value='鼓浪屿区人事劳动和社会保障局'>鼓浪屿区人事劳动和社会保障局</option>";
		htmlid = htmlid+ "<option value='厦门市开元区人事劳动和社会保障局'>厦门市开元区人事劳动和社会保障局</option>";
		htmlid = htmlid+ "<option value='厦门市湖里区人才交流咨询服务中心'>厦门市湖里区人才交流咨询服务中心</option>";
		htmlid = htmlid+ "<option value='厦门市同安区人事劳动和社会保障局'>厦门市同安区人事劳动和社会保障局</option>";
		htmlid = htmlid+ "<option value='厦门海沧人才交流服务中心'>厦门海沧人才交流服务中心</option>";
		htmlid = htmlid+ "<option value='厦门市杏林区人事劳动和社会保障局'>厦门市杏林区人事劳动和社会保障局</option> ";
        htmlid = htmlid+ "  </select>  "  
	    hrShow.innerHTML = htmlid;  
}
function showChoice(){
       var htmlid1 = "<input name=\"nohrShow\" type=\"text\" size=\"30\" maxlength=\"45\" onChange=\"putValue()\" class=\"myInput\">";
	   hrShow.innerHTML = htmlid1;  
}
function putValueHR(){    main.mFSUName.value=main.FSUSelect.options[main.FSUSelect.selectedIndex].value; }
function putValue(){     main.mFSUName.value=main.nohrShow.value; }
//于tpc/local/edit.jsp中赋隐藏值
function jobOutOfXM1()
{
   main.jobOutOfXM.value="jobOutOfXMID";
   main.submit();
}

//  落户功能  
function getPreference()
{ 
  var newWin=window.open("settleID.jsp", "settleID","left=500; top=270; status=no; width=270; height=185; toolbar=yes;");
  newWin.focus();
}
approveText
//  审核意见，显示在审核栏目功能
function approveText(str)
{ 
  document.formSend.approveResult.value = str;
  return true;
}