function checkfrm_login() {
	temp=document.form_login.user_id;
	if (temp.value==""){
		alert("请输入用户名");
		temp.focus();
		return false;
	}else{
		tmp=temp.value;
		while(tmp.charAt(0)==" ")
			tmp=tmp.substring(1);
		if (tmp==""){
			alert("请输入用户名");
			temp.focus();
			return false;
		}
	}
	temp=document.form_login.password;
	if (temp.value==""){
		alert("请输入密码");
		temp.focus();
		return false;
	}else{
		tmp=temp.value;
		while(tmp.charAt(0)==" ")
			tmp=tmp.substring(1);
		if (tmp==""){
			alert("请输入密码");
			temp.focus();
			return false;
		}
	}
	return true;
}

function load(){ 
	if (page_shortcut.select2.selectedIndex > 0) location = page_shortcut.select2.options[page_shortcut.select2.selectedIndex].value;
}

function OpenUpload(theField)
{
	if(showPic) {
		var str=null;
		str=showPic();
		if (str!=null)	{
			theField.value=str;
		}
	}	
	else {
		alert("该功能在此处无效！");
	}
}

function showPic()
{
 	return window.showModalDialog("../uploadfile/selectfile.php");
}

function checkdel(theField)
{
	if (!checkvalue(theField))
		return false;
    if (confirm("删除记录可能造成不确定后果，确认删除吗？"))
		return true;
		else
		return false;
}

function checkoperate(theField)
{
	if (!checkvalue(theField))
		return false;
    if (confirm("确认操作吗？"))
		return true;
		else
		return false;
}

function checkvalue(theField)
{
   if (theField.value){
		if (!theField.checked){
				alert("请选择纪录！"); 
			return false;
			}
   }else{
		len=theField.length;
		flag=false;
		for (i=0;i<len;i++)
		{
			if ( theField[i].checked)
				flag=true;
		}
		if (!flag){
			alert("请选择纪录！");
			return false;
		}
   } 
   return true;
 }

function cfmdel()
{
    if (confirm("删除记录可能造成不确定后果，确认删除吗？"))
		return true;
		else
		return false;
}

function selectall() {
  for(i = 0; i < document.form1.elements('selid[]').length; i++) {
    document.form1.elements['selid[]'][i].checked=true;
  }
}

function clearall() {
  for(i = 0; i < document.form1.elements('selid[]').length; i++) {
    document.form1.elements['selid[]'][i].checked=false;
  }
}

function swap_status() {
  if (document.form1.elements['swap[]'].checked == true) {
    for(i = 0; i < document.form1.elements('selid[]').length; i++) {
      document.form1.elements['selid[]'][i].checked = true;
    }
  } else {
    for(i = 0; i < document.form1.elements('selid[]').length; i++) {
      document.form1.elements['selid[]'][i].checked = false;
    }
  }
}

function swap_favorites_status() {
  if (document.common.elements['swap[]'].checked == true) {
    for(i = 0; i < document.common.elements('selid[]').length; i++) {
      document.common.elements['selid[]'][i].checked = true;
    }
  } else {
    for(i = 0; i < document.common.elements('selid[]').length; i++) {
      document.common.elements['selid[]'][i].checked = false;
    }
  }
}

function clearCompanyText() {
  if (document.powersearch.company_keyword.value == "Input Keyword for Company") {
    document.powersearch.company_keyword.value = "";
  }
}

function clearPositionText() {
  if (document.powersearch.position_keyword.value == "Input Keyword for Job Title") {
    document.powersearch.position_keyword.value = "";
  }
}

function clearDescriptionText() {
  if (document.powersearch.description_keyword.value == "Input Keyword for Description") {
    document.powersearch.description_keyword.value = "";
  }
}

function clearEducationText() {
  if (document.powersearch.education_keyword.value == "Input Keyword for Education") {
    document.powersearch.education_keyword.value = "";
  }
}

function clearExperienceText() {
  if (document.powersearch.experience_keyword.value == "Input Keyword for Experience") {
    document.powersearch.experience_keyword.value = "";
  }
}

function presearch(encodequery) {
  document.powersearch.target = "_self";
  document.powersearch.action = "my_jobsearch.php?" + encodequery;
  document.powersearch.submit();
}

function tpresearch(encodequery) {
  document.powersearch.target = "_self";
  document.powersearch.action = "my_teacherjobsearch.php?" + encodequery;
  document.powersearch.submit();
}

function rpresearch(encodequery) {
  document.powersearch.target = "_self";
  document.powersearch.action = "Trash.php?" + encodequery;
  document.powersearch.submit();
}

function search(encodequery) {
  document.powersearch.target = "_self";
  document.powersearch.action = "my_jobsearch_result.php?" + encodequery;
  document.powersearch.submit();
}

function rsearch(encodequery) {
  document.powersearch.target = "_self";
  document.powersearch.action = "resumelist.php?" + encodequery;
  document.powersearch.submit();
}

function tsearch() {
  document.powersearch.target = "_blank";
  document.powersearch.action = "http://www.chinajob.com/individual/my_teacherjobsearch_result.php";
  document.powersearch.submit();
}

function jsearch() {
  document.form_search.target = "_blank";
  document.form_search.action = "http://www.chinajob.com/individual/my_jobsearch_result_home.php";
  document.form_search.submit();
}

function search_pager(action) {
  document.common.target = "_self";
  document.common.action = action;
  document.common.submit();
}

function jds(id) {
  document.common.target = "_blank";
  document.common.action = "/individual/my_jobdetail.php";
  document.common.job_id.value = id;
  document.common.submit();
}

function rds(id) {
  document.common.target = "_blank";
  document.common.action = "resumedetail.php";
  document.common.id.value = id;
  document.common.submit();
}

function ajds(id) {
  document.common.target = "_blank";
  document.common.action = "/individual/my_jobdetail_all.php";
  document.common.unit_id.value = id;
  document.common.submit();
}

function tajds(id) {
  document.common.target = "_blank";
  document.common.action = "/jobposter/teacher/jobdetailall.php";
  document.common.unit_id.value = id;
  document.common.submit();
}

function as(id) {
  document.common.target = "_blank";
  document.common.action = "my_agent_detail.php";
  document.common.agent_id.value = id;
  document.common.submit();
}

function show_interview(id) {
  document.interview.target = "_self";
  document.interview.action = "my_interview_detail.php";
  document.interview.proj_id.value = id;
  document.interview.submit();
}

function acceptinterview(id) {
  document.common.target = "_self";
  document.common.proj_id.value = id;
  document.common.interview_status.value = 1;
  document.common.aa.value = "do";
  document.common.submit();
}

function rejectinterview(id) {
  document.common.target = "_self";
  document.common.proj_id.value = id;
  document.common.interview_status.value = 0;
  document.common.aa.value = "do";
  document.common.submit();
}
function checkEmailFormat(str){
	if(str.value.indexOf("@")==-1){
		alert("错误，输入的Email地址错误。");
		str.focus();
		return false;
	}
	if(str.value.substring(str.value.indexOf("@")+1,str.value.length).indexOf("@")!=-1){
		alert("错误，输入的Email地址错误。");
		return false;
	}
	if(str.value.indexOf(".")==-1){
		alert("错误，输入的Email地址错误。");
		return false;
	}
	if(str.value.length<7){
		alert("错误，输入的Email地址错误。");
		return false;
	}
	for (i=0;i<=errStr.length;i++){
		if (str.value.indexOf(errStr[i])!=-1){
			alert('错误，输入的Email地址中不能带有 '+ errStr[i] +' 字符');
			return false;
		}
	}
	if (!checkCannot(str)){
		return false;
	}
	if (!checkBlur(str)){
		return false;
	}

	return true;
}
function viewjob(jobid,uname) {
  document.form_joblist.target = "_blank";
  document.form_joblist.job_id.value = jobid;
  document.form_joblist.company_name.value = uname;
  document.form_joblist.submit();
}
function viewteacher(jobid,uname) {
  document.form_teacherlist.target = "_blank";
  document.form_teacherlist.job_id.value = jobid;
  document.form_teacherlist.company_name.value = uname;
  document.form_teacherlist.submit();
}

function showEducational() {
  edublock.style.display="";
  problock.style.display="none";
  ei.style.cursor="hand;";
  ei.style.background="#FFFFFF";
  pi.style.background="#F2F2F2";
  ei.style.borderBottom="";
  ei.style.emptyCells="hide";
  pi.style.borderBottom="thin solid #c5ccd2";
  //pi.style.emptyCells="show";
}

function showProfessional() {
  edublock.style.display="none";
  problock.style.display="";
  pi.style.cursor="hand;";
  pi.style.background="#FFFFFF";
  ei.style.background="#F2F2F2";
  pi.style.borderBottom="";
  pi.style.emptyCells="hide";
  ei.style.borderBottom="thin solid #c5ccd2";
  //ei.style.emptyCells="show";
}

function showJobSeeker() {
  jobseekerblock.style.display="";
  employerblock.style.display="none";
}

function showEmployer() {
  jobseekerblock.style.display="none";
  employerblock.style.display="";
}

function show_user_login() {
	$("#window_1").show();
}