var postencodestr=""
var applytarget="";

function initedquickapply(){
	document.write('<form action="/seeker/apply.do?m=sendquick&sendtype=usersendQuick" method="post" name="applyForm1">');
	document.write('		<input type="hidden" name="postIds" value="'+postencodestr+'"><div class="column" id="loginnoselect" style="display:none">');
	document.write('				<div class="send">');
	document.write('<input type="button" name="cocontinue" id="ct_email_continue"  style="cursor:hand;" onclick="applyQuickLogin();" value="　　快速投递　　"/>	<a href="javascript:switchToApply(\'loginselect\');showApplySelect();getResumeInfo();">选择一份简历</a> <a href="javascript:switchToApply(\'loginselect\');showApplySelect();getResumeInfo();">添加求职信</a>');
	document.write('</div>');
	document.write('				');
	document.write('					</div></form>');
	document.write('						<form action="/seeker/apply.do?m=sendquick" name="applyForm2" method="post" onclick="showApplySelect();">');
	document.write('		<input type="hidden" name="postIds" value="'+postencodestr+'">');
	document.write('					<div class="column" id="loginselect" style="display:none">');
	document.write('<div class="apply_in">');
	document.write('  <div class="num_02">');
	document.write('		<div class="h1blk1"><h2>选择一份简历进行投递</h2></div>');
	document.write('		<div class="note1">如果您当前没有简历，<a href="/seeker/manager.do?m=create" target="none">点击这里新建一份简历</a></div>');
	document.write('		');
	document.write('	  ');
	document.write('	  <div id="resumeListElement">		');
	document.write('		</div>');
	document.write('			<div class="h1blk1">');
	document.write('			<h2><input type="checkbox" name="useletter" value="1" onclick="if(this.checked){document.getElementById(\'ShowLetter\').style.display=\'block\';}else{document.getElementById(\'ShowLetter\').style.display=\'none\';}showApplySelect();">附求职信</h2>');
	document.write('			<div id="LetterAll">');
	document.write('			');
	document.write('			<div id="ShowLetter" style="display:none">');
	document.write('				<select name="letter" onchange="getApplyletter(this.value);"></select>');
	document.write('				<br><textarea name="content" cols="75" rows="7" style="font-size:12px;"></textarea>');
	document.write('			</div>');
	document.write('			</div>');
	document.write('	  	</div>	');
	document.write('	</div>');
	document.write('<div class="send">');
	document.write('<input type="button" name="cocontinue" class="button1" onclick="applyQuickSelect();" value="　　继　　　续　　"/>');
	document.write('</div>');
	document.write('');
	document.write('</div>');
	document.write('					</div>');
	document.write('					</form>');
	document.write('					<form method="post" action="/seeker/apply.do?m=sendquick" name="applyForm" onclick="showApply();">');		
	document.write('					<input type="hidden" name="postIds" value="'+postencodestr+'">');
	document.write('					<div class="column" id="nologin" style="display:none">');
	document.write('						<div class="b1">');
	document.write('							<ul>');
	document.write('								<li id="ca1" style="margin: 8px 0 0 0;" class="column_01"');
	document.write('onclick="javascript:displayB(\'ca\',\'na\',1)" title="非会员投递">');
	document.write('非会员投递');
	document.write('								</li>');
	document.write('								<li id="ca2" class="column_02" onclick="javascript:displayB(\'ca\',\'na\',2);document.getElementById(\'loginframe\').src=\'/seeker/login3.jsp\';" title="会员投递">');
	document.write('会员投递');
	document.write('								</li>');
	document.write('							</ul>');
	document.write('						</div>');
	document.write('						<div class="b2">');
	document.write('							<div class="b2_mid">');
	document.write('								<ul id="na1">');
	document.write('<div class="conblk">');
	document.write('	<h2>');
	document.write('		粘贴简历,快捷投递');
	document.write('		<span class="tell" id="email_error"></span>');
		document.write('		<span style="height:20px;border: 1px solid #FFCC00; font-size:12;color:#ff0000;display:none;" id="mailerror"></span>');
	document.write('	</h2>');
	document.write('</div>');
	document.write('<div style="margin-bottom: 5px;background:#FFFFFF;">');
	document.write('	<b>您的Email;</b>');
	document.write('	<input type="text" name="myemail"  onblur="checkemail();" onchange="checkexist=true;" class="chk" onfocus="showApply();"/>');
	document.write('	<b>工作年限：</b>');
document.write('');
document.write('<select name="workyear">');
document.write('	<option value="">工作年限</option>');
document.write('	<option value="0">在读学生</option>');
document.write('	<option value="1">一年</option>');
document.write('	<option value="2">两年</option>');
document.write('	<option value="3">三年</option>');
document.write('	<option value="4">四年</option>');
document.write('	<option value="5">五年</option>');
document.write('	<option value="6">六年</option>');
document.write('	<option value="7">七年</option>');
document.write('	<option value="8">八年</option>');
document.write('	<option value="9">九年</option>');
document.write('	<option value="10">九年以上</option>');
document.write('</select>							');			
document.write('<select name="degree">');
document.write('	<option value="">学历</option>		');		
document.write('	<option value="1">博士后</option>');
document.write('	<option value="2">博士</option>');
document.write('	<option value="3">硕士</option>');
document.write('	<option value="4">本科</option>');
document.write('	<option value="5">大专</option>');
document.write('	<option value="6">中专</option>');
document.write('	<option value="7">高中</option>');
document.write('	<option value="8">初中</option>');
document.write('	<option value="9">小学</option>');
document.write('	</select>');
	document.write('</div>');
	document.write('<div class="resume"  id="detailinfo">');
	document.write('	<iframe onfocus="hiddenresumetext();" onblur="showresumetext();" id="multiedit" marginwidth=0 marginheight=0 frameborder=0 height="150" width="100%" name="multiedit" scrolling="no" align="top" src="/seeker/resume1/multiedit.htm" ></iframe>');
	document.write('		<textarea name="resumetext" style="display:none;"><div  style=\'font-size:12px;padding:5px;\'>在此拷贝粘贴WORD简历，一键快捷投递！！！</div></textarea>');
	document.write('</div>');
	document.write('<div>');
	document.write('	<input type="button" name="Submit" value="申请该职位"');
	document.write('		class="button1" id="ct_email_continue" onclick="applyQuick();" />');
	document.write('</div>');
	document.write('								</ul>');
	document.write('								<ul id="na2" style="display: none;">');
	document.write('<iframe id="loginframe" width="100%" height="240"');
	document.write('	allowTransparency="true" border="0" frameborder="0"');
	document.write('align="center" src="" name="loginframe"></iframe>');
	document.write('								</ul>');
	document.write('							</div>');
	document.write('							');
	document.write('							');
	document.write('						</div>');
	document.write('					</div>');
	document.write('					</form>');
}
function showApply(){
	//spost.height=window.screen.availHeight-500;
	//document.getElementById("detailinfo").style.display="";
	//document.getElementById("applyelement").height="270";
	//document.getElementById("openclose").innerHTML="<a href=\"javascript:showSource();\"><img src=\"/t/5/images/close.gif\" align=\"absmiddle\" />关闭栏目</a>";
}
function showApplySelect(){
	if(document.getElementById("ShowLetter").style.display=="none"){
		//spost.height=window.screen.availHeight-500;
	}else{
		//spost.height=window.screen.availHeight-600;
	}
	
	//document.getElementById("detailinfo").style.display="";
	//document.getElementById("applyelement").height="270";
	//document.getElementById("openclose").innerHTML="<a href=\"javascript:showSource();\"><img src=\"/t/5/images/close.gif\" align=\"absmiddle\" />关闭栏目</a>";
	
}
function openApply(){
	
	if(document.getElementById("nologin").style.display!="none"){
		showApply();
	}
	else if(document.getElementById("loginnoselect").style.display!="none"){
		showApply();
	}
	else if(document.getElementById("loginselect").style.display!="none"){
		showApply();
	}
}
function showSource(){
	
	//spost.height=window.screen.availHeight-350;
	//document.getElementById("detailinfo").style.display="none";
	//document.getElementById("applyelement").height="50";
	//document.getElementById("openclose").innerHTML="<a href=\"javascript:openApply();\"><img src=\"/t/5/images/close.gif\" align=\"absmiddle\" />展开栏目</a>";
}
var regname;
var checkexist=true;
var cannext=false;
var errormess="请输入正确的电子邮件";
function checkemail(){
	
	if(!checkexist){
		return;
	}	

	if(document.applyForm.myemail.value.indexOf("@yahoo.")>-1){
  		document.getElementById("mailerror").innerHTML="YAHOO邮箱将不能正常接收系统发送的企业回复通知，建议你使用 <a href=\"http://mail.163.com/\" target=\"_target\">163邮箱</a> <a href=\"http://mail.google.com/\" target=\"_target\">gmail</a> <a href=\"http://mail.qq.com/\" target=\"_target\">QQ邮箱</a> ";
  		document.getElementById("mailerror").style.display="block";
  	}else{
  		document.getElementById("mailerror").style.display="none";
  	}
	var ct_email=document.applyForm.myemail.value;
	isemail  =/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	if(!isemail.test(ct_email)){  		
		  	document.getElementById("email_error").innerHTML="<font color='#ff0000'>请输入正确的电子邮件</font>";	
		  	return;
	}
	document.getElementById("email_error").innerHTML="<font color='#ff0000'>正在检验电子邮件有效性,请稍候.....</font>";	
	document.getElementById("ct_email_continue").value="　　请　稍　候　　";
	document.getElementById("ct_email_continue").disabled="disabled";
	loadXML("/seeker/seekerreg.do?m=checkemail&email="+ct_email,showEmailinfo);	
	cannext=false;
}
function showEmailinfo(resXMLDOM){	
			//resXMLDOM = xmlDocument.responseXML;
			document.getElementById("ct_email_continue").style.display="block";		
			var root = resXMLDOM.documentElement;				
			if(isok(root)){
				document.getElementById("email_error").innerHTML="<font color='#ff0000'>电子邮件已使用，您已经是注册用户了，请<a href=\"javascript:display(2);document.getElementById('loginframe').src='/seeker/login3.jsp';\">登录</a>后再投递，谢谢！，<a href='/seeker/forgetpwd.jsp' target='_blank'>忘记密码请点击这里</a>，或者输入其他邮箱地址。</font>";
				errormess="电子邮件已使用，您已经是注册用户了，请登录后再投递，谢谢！";
			}else{
				document.getElementById("email_error").innerHTML="<font color='#ff0000'>电子邮件可用</font>";	
				cannext=true;
			}
			checkexist=false;
			document.getElementById("ct_email_continue").value="　　继　　　续　　";
			document.getElementById("ct_email_continue").disabled="";
}
function hiddenresumetext(){
	var con=multiedit.HtmlEditor.document.body.innerHTML;
	if(con.indexOf("在此拷贝粘贴WORD简历")>-1){
		multiedit.HtmlEditor.document.body.innerHTML="";
	}
	showApply();
}
function showresumetext(){
	var con=multiedit.HtmlEditor.document.body.innerHTML;
	if(con==""){
		multiedit.HtmlEditor.document.body.innerHTML="<div  style='font-size:12px;padding:5px;'>在此拷贝粘贴WORD简历，一键快捷投递！！！</div>";
	}
}
function switchToApply(showname){
	document.getElementById("loginselect").style.display="none";
	document.getElementById("loginnoselect").style.display="none";
	document.getElementById("nologin").style.display="none";
	document.getElementById(showname).style.display="block";
	
}

function getResumeInfo(){
	
	loadXML("/seeker/manager.do?m=resumeinfo",showResumeinfo);	
}

function showResumeinfo(resXMLDOM){	
	var root = resXMLDOM.documentElement;
	if(isok(root)){
		var option=document.applyForm2.letter.options;
		var letters= root.getElementsByTagName("letter");
		option.length = letters.length + 1;
		option[0].text="请选择";
		option[0].value="";
		for(var i=0;i<letters.length;i++){
			id=getNodeValue(SelectSingleNode(letters[i],"id"));
			name=getNodeValue(SelectSingleNode(letters[i],"name"));
			option[i+1].text=name;
			option[i+1].value=id;			
		}
		option.selectedIndex=0;
		
		var selectedId= getNodeValue(SelectSingleNode(root,"selectedId"));
		
		var resumestring="<table class=\"list\">";
		resumestring+='<tr> ';	
		resumestring+='		<th height="25">简历名称</th>';	
		resumestring+='		<th width="200">最后修改时间</th>';	
		resumestring+='		<th width="110">操作</th>';	
		resumestring+='	</tr>';	
		var resumes= root.getElementsByTagName("resume");
		for(var i=0;i<resumes.length;i++){
			rid=getNodeValue(SelectSingleNode(resumes[i],"rid"));
			name=getNodeValue(SelectSingleNode(resumes[i],"name"));
			lastmodify=getNodeValue(SelectSingleNode(resumes[i],"lastmodify"));
			resumestring+='<tr>';			
			resumestring+='<td>';	
			if(selectedId!=null){
				if(selectedId==rid){
					resumestring+='<input type="radio" name="resumeid" value="'+rid+'" checked="true">';
				}else{
					resumestring+='<input type="radio" name="resumeid" value="'+rid+'">';
				}
			}else{
				resumestring+='<input type="radio" name="resumeid" value="'+rid+'">';
			}
			resumestring+=name;
			resumestring+='</td>';
			resumestring+='<td>';			
			resumestring+=lastmodify;
			resumestring+='</td>';
			resumestring+='<td>';			
			resumestring+='<a href="/seeker/manager.do?m=editresume1&resumeId='+rid+'" target="_blank">修改</a> | <a href="/preview.do?MOTION=simple&resumeId='+rid+'" target="_blank">预览</a> ';
			resumestring+='</td>';		
			resumestring+='</tr>';
		
		}
		resumestring+="</table>";
		
			document.getElementById("resumeListElement").innerHTML=resumestring;
			
			
			
	}else{
		alert('error');
	}
}
function getApplyletter(id){
	loadXML("/seeker/applyLetter.do?m=get&id="+id,showApplyLetter);	
}
function showApplyLetter(resXMLDOM){
	
	var root = resXMLDOM.documentElement;				
	
	document.applyForm2.content.value=getNodeValue(SelectSingleNode(root,"content"));							
}
function loginok(){
	showLogin();
	document.getElementById("loginnoselect").style.display="none";
	document.getElementById("loginselect").style.display="block";
	getResumeInfo();
	
}
var regname;
function showLogin(){
	document.getElementById("loginselect").style.display="none";
	document.getElementById("loginnoselect").style.display="none";
	document.getElementById("nologin").style.display="none";
	document.getElementById("loginnoselect").style.display="block";
	
}
function showNotLogin(){
	document.getElementById("nologin").style.display="block";
}

function loaded()
{
	multiedit.HtmlEditor.document.body.innerHTML=document.applyForm.resumetext.value;
}
function applyQuick(){
	
	document.applyForm.resumetext.value=multiedit.HtmlEditor.document.body.innerHTML;
	if(document.applyForm.resumetext.value.length<40){
		alert("你的粘贴简历，不够完善。请完善！（描述信息不得小于40个字）");
		multiedit.HtmlEditor.focus();
		return;
	}else if(document.applyForm.resumetext.value.indexOf("拷贝粘贴")>-1){
		alert("您还未填写粘贴简历，拷贝粘贴您原来准备好的简历即可！也可手动录入！");
		multiedit.HtmlEditor.focus();
		return;
	}
	if(!cannext){
		alert(errormess);
		document.applyForm.myemail.focus();
		return;
	}
	document.applyForm.elements['ct_email_continue'].disabled="true";
	if(applytarget==""){
		document.applyForm.submit();
	}else{
		document.applyForm.target=applytarget;
		document.applyForm.submit();
		document.getElementById("applyelement")="";
	}
	
}
function applyQuickLogin(){

document.applyForm1.submit();
}
function applyQuickSelect(){
	var useletterEl=document.getElementsByName("useletter")[0];
	if(useletterEl.checked){
		if(document.applyForm2.content.value.length<30){
			alert("请输入求职信的内容,字数不能小于30个字,当前您已经输入了"+document.applyForm2.content.value.length+"个字,请继续完善该求职信");
			document.applyForm2.content.focus();
			return;
		}
		if(document.applyForm2.content.value.length>3000){
			alert("请输入求职信的内容,字数不能大于3000个字,当前您已经输入了"+document.applyForm2.content.value.length+"个字,请简化你的求职信");
			document.applyForm2.content.focus();
			return;
		}
	}
document.applyForm2.submit();
}
//导航
var lvren_navi_cate_limit = 8;
	function menu_focus(id){
	   for(i=1;i<=lvren_navi_cate_limit;i++){
		   
		   //id nav_$i_s  nav_$i_a
		   var navi_s_tmp_str = "menu_"+i+"_s";
		   var navi_a_tmp_str = "menu_"+i+"_a";
		   var navi_l_tmp_str = "menu_link_"+i;
		   if(id == i){
			 document.getElementById(navi_s_tmp_str).style.display='';
			 document.getElementById(navi_a_tmp_str).style.display='none';
			 document.getElementById(navi_l_tmp_str).style.display='';
			 
		   }else{
			 document.getElementById(navi_s_tmp_str).style.display='none';
			 document.getElementById(navi_a_tmp_str).style.display='';
			 document.getElementById(navi_l_tmp_str).style.display='none';
		   }//end of if 
	   }
	}

//输入框
function checkLogin(content,n) {
	if (n == 0 && content.value == "输入关键字-例如：销售"){
	   
		content.value="";
	}
	if (n == 1){
		if(content.value == "输入关键字-例如：销售"){content.value="";}
		
	}
	if (n == 2 && content.value == ""){content.value = "输入关键字-例如：销售";}
}	

//搜索框
function displayB(cname,nname,num){
   document.getElementById(cname+num).className="column_01";
   document.getElementById(nname+num).style.display="";
   
   for(var i=1;i<=10;i++){
   if(i!=num){
   if(document.getElementById(cname+i)!=null&&document.getElementById(nname+i)!=null){
   document.getElementById(cname+i).className="column_02";
   document.getElementById(nname+i).style.display="none";
   }
   }
   }
}

//分类
function showMM(num){
	var num="MM"+num;
	document.getElementById(num).style.display="block";
}
function hideMM(num){
	var num="MM"+num;
	document.getElementById(num).style.display="none";
}
