// JavaScript Document

	function CrXMLHttpRequest()
	{
		if(window.XMLHttpRequest) { //Mozilla 
			xmlHttp = new XMLHttpRequest();
		}
		else if (window.ActiveXObject) { //IE
			try {
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
				try {
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
	}
	
	function delete_info(tablename,deltrid,rs_id)
	{
		if(isConfir("警告：删除后将无法恢复\n\n是否还要继续操作?")==true)
		{
			CrXMLHttpRequest();
			
			xmlHttp.open("POST","index_do.php?action=del&table="+tablename+"&id="+rs_id,false);
			xmlHttp.send(null);
			
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
				
				if(xmlHttp.responseText==1)
				{
						
					//alert("s");	
					document.getElementById('hr_word'+deltrid).style.display="none";
					//document.theForm.oldPhotoUrl_Thumb+deltrid.value="";
					//Geobj("oldimg_num").value = parseInt(Geobj("oldimg_num").value-1);
				}
				else
				{
					document.getElementById('hr_word'+deltrid).style.display="";
				}
			}
		}
		//var oRow = Geobj(tableid).deleteRow(suoyid);
	}


	function startRequest(url) {
		
		createXMLHttpRequest();
		
		//alert(xmlHttp);
		
		xmlHttp.open("GET",url,true);
		
		xmlHttp.onreadystatechange=RSchange;
		
		xmlHttp.send(null);
		
	}
	
	function RSchange(){
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			
			
			if(xmlHttp.responseText==1){
				alert("提交成功!");	
			}else{
				alert("失败!");
			}
		}	
	
	}
	
	function isConfir(msg){
		
		var value=window.confirm(msg);
		return value;
		
	}
	
    function chkForm_base(){
	
		var theform=document.form1;
		
		if(theform.username.value==""){
			
			document.getElementById("username_red").innerHTML="姓名不能为空";
			
			return false;
		}else{
			
			document.getElementById("username_red").innerHTML="";
			
		}
		
		if(theform.sex.value==""){
			
			document.getElementById("sex_red").innerHTML="性别不能为空";
			
			return false;
		}else{
			
			document.getElementById("sex_red").innerHTML="";
		}
		
		if(theform.national.value==""){
			
			document.getElementById("national_red").innerHTML="民族不能为空";
			
			return false;
		}else{
			
			document.getElementById("national_red").innerHTML="";
		}
		
		if(theform.education.value==""){
			
			document.getElementById("education_red").innerHTML="学历不能为空";
			
			return false;
		}else{
			
			document.getElementById("education_red").innerHTML="";
		}
		
		if(theform.professional.value==""){
			
			document.getElementById("professional_red").innerHTML="专业不能为空";
			
			return false;
		}else{
			
			document.getElementById("professional_red").innerHTML="";
		}
		
		if(theform.graduation_school.value==""){
			
			document.getElementById("graduation_school_red").innerHTML="毕业学校不能为空";
			
			return false;
		}else{
			
			document.getElementById("graduation_school_red").innerHTML="";
		}
		
		if(theform.mobile_phone.value==""){
			
			document.getElementById("mobile_phone_red").innerHTML="手机不能为空";
			
			return false;
		}else{
			
			document.getElementById("mobile_phone_red").innerHTML="";
		}
		
		return true;
	}
	
	function chkForm_work(){
		
		var theform=document.form1;
		
		if(theform.experience_company.value==""){
			
			document.getElementById("experience_company_red").innerHTML="公司名称不能为空";
			
			return false;
		}else{
			
			document.getElementById("experience_company_red").innerHTML="";
		}
		
		if(theform.experience_start_time.value==""){
			
			document.getElementById("experience_start_time_red").innerHTML="开始时间不能为空";
			
			return false;
		}else{
			
			document.getElementById("experience_start_time_red").innerHTML="";
		}
		
		if(theform.experience_end_time.value==""){
			
			document.getElementById("experience_end_time_red").innerHTML="结束时间不能为空";
			
			return false;
		}else{
			
			document.getElementById("experience_end_time_red").innerHTML="";
		}
		
		if(theform.work_position.value==""){
			
			document.getElementById("work_position_red").innerHTML="工作职位不能为空";
			
			return false;
		}else{
			
			document.getElementById("work_position_red").innerHTML="";
		}
		
		return true;
	}
	
	function chkForm_family(){
		
		var theform=document.form1;
		
		if(theform.relations.value==""){
			
			document.getElementById("relations_red").innerHTML="称谓不能为空";
			
			return false;
		}else{
			
			document.getElementById("relations_red").innerHTML="";
		}
		
		if(theform.name.value==""){
			
			document.getElementById("name_red").innerHTML="姓名不能为空";
			
			return false;
		}else{
			
			document.getElementById("name_red").innerHTML="";
		}
		
		if(theform.company.value==""){
			
			document.getElementById("company_red").innerHTML="工作单位不能为空";
			
			return false;
		}else{
			
			document.getElementById("company_red").innerHTML="";
		}
		
		if(theform.position.value==""){
			
			document.getElementById("position_red").innerHTML="职务/岗位不能为空";
			
			return false;
		}else{
			
			document.getElementById("position_red").innerHTML="";
		}
		
		return true;
	}
	
	function chkForm_study(){
		
		var theform=document.form1;
		
		if(theform.school.value==""){
			
			document.getElementById("school_red").innerHTML="毕业学校不能为空";
			
			return false;
		}else{
			
			document.getElementById("school_red").innerHTML="";
		}
		
		if(theform.study_start_time.value==""){
			
			document.getElementById("study_start_time_red").innerHTML="开始时间不能为空";
			
			return false;
		}else{
			
			document.getElementById("study_start_time_red").innerHTML="";
		}
		
		if(theform.study_end_time.value==""){
			
			document.getElementById("study_end_time_red").innerHTML="结束时间不能为空";
			
			return false;
		}else{
			
			document.getElementById("study_end_time_red").innerHTML="";
		}
		
		if(theform.study_qualifications.value==""){
			
			document.getElementById("study_qualifications_red").innerHTML="学历不能为空";
			
			return false;
		}else{
			
			document.getElementById("study_qualifications_red").innerHTML="";
		}
		
		return true;
	}
	
	function chkForm_training(){
		
		var theform=document.form1;
		
		if(theform.units.value==""){
			
			document.getElementById("units_red").innerHTML="培训单位不能为空";
			
			return false;
			
		}else{
			
			document.getElementById("units_red").innerHTML="";
		}
		
		if(theform.training_start_time.value==""){
			
			document.getElementById("training_start_time_red").innerHTML="开始时间不能为空";
			
			return false;
			
		}else{
			
			document.getElementById("training_start_time_red").innerHTML="";
		}
		
		if(theform.training_end_time.value==""){
			
			document.getElementById("training_end_time_red").innerHTML="结束时间不能为空";
			
			return false;
		}else{
			
			document.getElementById("training_end_time_red").innerHTML="";
		}
		
		if(theform.certificate.value==""){
			
			document.getElementById("certificate_red").innerHTML="获得证书不能为空";
			
			return false;
		}else{
			
			document.getElementById("certificate_red").innerHTML="";
		}
		
		return true;
	}
	
	 function exit(){
		if(confirm("确定退出登录？")==true){
			window.location="exit.php";
		} 
	 }
	 
	function check_msg(){
	
		var theform=document.form1;
		
		if(theform.username.value==""){
			
			alert("请输入姓名");
			theform.username.focus();
			return false;
		
		}
		
		var tag=0;
		for(i=0;i<theform.sex.length;i++){
			
			if(theform.sex[i].checked==true){
				tag=1;
			}
			
		}
		if(tag==0){
				alert("请选择性别");
				return false;
		}
		if(theform.degree.value==""){
			alert("学位不能为空");
			theform.degree.focus();
			return false;
		}
		
		if(theform.phone.value==""){
			alert("请输入手机号码");
			theform.phone.focus();
			return false;
		}
	
		if(theform.content.value==""){
			alert("请发表你的意见或建议");
			theform.content.focus();
			return false;
		}
	}
	function chkForm_step(step){
		
		var theform=document.form1;
		
		if(theform.company.value==""){
			
			if(step=="1"){
				
				document.getElementById("company"+step).innerHTML="颁发单位不能为空";
				
				return false;
				
			}else if(step=="2"){
				
				document.getElementById("company"+step).innerHTML="组织不能为空";
				
				return false;
				
			}else if(step=="3"){
				
				document.getElementById("company"+step).innerHTML="单位不能为空";
				
				return false;
			}
			
		}else{
			
			document.getElementById("company"+step).innerHTML="";
		}
		
		
		
		if(theform.start_time.value==""){
			
			document.getElementById("start_time"+step).innerHTML="开始时间不能为空";
			
			return false;
			
		}else{
			
			document.getElementById("start_time"+step).innerHTML="";
		}
		
		if(theform.end_time.value==""){
			
			document.getElementById("end_time"+step).innerHTML="结束时间不能为空";
			
			return false;
			
		}else{
			
			document.getElementById("end_time"+step).innerHTML="";
			
		}
		
		if(theform.content.value==""){
			
			if(step=="1"){
				
				document.getElementById("content"+step).innerHTML="奖项/内容不能为空";
				
				return false;
				
			}else if(step=="2"){
				
				document.getElementById("content"+step).innerHTML="职务/职责不能为空";
				
				return false;
				
			}else if(step=="3"){
				
				document.getElementById("content"+step).innerHTML="实践内容不能为空";
				
				return false;
			}
			
		}else{
			
			document.getElementById("content"+step).innerHTML="";
		}
		
		return true;
		
	}