function ToSave(type)
{
  if (CheckOK())
   {
	  if (type==1)
	  {
		  document.Form1.next_step.value = 1;
	  }
     document.Form1.AreaCode.value="";
     document.Form1.submit();
   }
}

function CheckOK()
{
	var sureMS;

  if (Jtrim(document.Form1.realname.value) == "")
  {
    window.alert("请输入姓名！");
    document.Form1.realname.focus();
    return false;
  }


 if ( ! isValidDate(document.Form1.year_birthday.value, document.Form1.month_birthday.value, document.Form1.day_birthday.value ))
 {  document.Form1.year_birthday.focus();
    return false;
 }
/*
  if (Jtrim(document.Form1.card.value) == "")
  {
    window.alert("请输入证件号码！");
    document.Form1.card.focus();
    return false;
  }
*/
  if (document.Form1.workyear.value == "0")
  {
    window.alert("请填写工作年限");
    document.Form1.workyear.focus();
    return false;
  }




  if (document.Form1.location.value == "")
  {
    window.alert("请填写居住地!");
    document.Form1.location.focus();
    return false;
  }

   if (document.getElementById('major[]').options.length==0)
  {
    window.alert("请选择专业!");
    document.getElementById('major[]').focus();
    return false;
  }


  if (Jtrim(document.Form1.email.value) == "")
  {
    window.alert("请填写EMAIL地址！");
    document.Form1.email.focus();
    return false;
  }
  
  if (!isemail(Jtrim(document.Form1.email.value)))
  {
    document.Form1.email.focus();
    return false;
  }

return true; 
}

function strlength(str){
	return str.replace(/[^\x00-\xff]/gi,'xx').length;
}

function GetObjID(ObjName)
{ for (var ObjID=0; ObjID < document.Form1.elements.length; ObjID++)
    if ( document.Form1.elements[ObjID].name == ObjName )
    {  return(ObjID);
       break;
    }
  return(-1);
}


function  SetIDType()
{ if (document.Form1.Nationality.value == "001")
      document.Form1.CardType.options[0].selected = true;
  else
      document.Form1.CardType.options[1].selected = true;
}


function ChangeOption(ObjName, DesName)
{
  //GET OBJECT VALUE, ID OF DESTINATION OBJECT
  ObjID    = GetObjID(ObjName);
  DesObjID = GetObjID(DesName);
  if ( ObjID != -1 && DesObjID != -1 )
  {
    CatValue = document.Form1.elements[ObjID].value.substring(0, 2);
    if ( CatValue == "0" )
      document.Form1.elements[DesObjID].length=0;
    else
    { //PARSING
      document.Form1.elements[DesObjID].length=0;
      var tt = document.Form1.AreaCode.value;
      var SubCategory = tt.split(";");
      //GENERATE OPTIONS
      j=0;
      for (var i=0; i< SubCategory.length; i++ )
      { pp = SubCategory[i].split(",");
        if ( pp[0].substring(0,2) == CatValue )
        {  if ( pp[0].substring(0,2) == CatValue)
           {  document.Form1.elements[DesObjID].options[j]= new Option( pp[1], pp[0]);
              j++;
           }
        }//if
      }//for
    }//if
  }//if


}
