// JavaScript Document
function AddFavorite(title, url) {
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")

}
function actmenu(mid) {
	$('#nav>li').removeClass('current');
	$('#nav>li:eq(' + mid + ')').addClass('current');
	;
}
function urlto(url) {
	location.href = url;
}
function SetHome(obja, url) {
	try {
		obja.style.behavior = 'url(#default#homepage)';
		obja.setHomePage(url);
	} catch (e) {
		if (window.netscape) {
			try {
				netscape.security.PrivilegeManager
						.enablePrivilege("UniversalXPConnect");
			} catch (e) {
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1']
					.getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage', url);
		}
	}
}
var online_ask_ui;
function online_ask() {
	var html = '<div class="npop">'
			+ '<div class="pop_til">'
			+ '<span class="f16 white bold">在线咨询</span>'
			+ ' </div>'
			+ '<div class="pop_nr" style="padding-top:20px;">'
			+ '<div class="wz">'
			+ ' <p class="f16 bold">您可以点击以下按钮进行在线咨询，我们随时为您解答！</p>'
			+ ' <p style="padding-top:15px;"><a target="op" href="http://wpa.qq.com/msgrd?v=1&amp;uin=1502426575&amp;site=qq&amp;menu=yes"><img title="点击这里给我发消息" alt="点击这里给我发消息" border="0" src="http://wpa.qq.com/pa?p=2:1502426575:41" /></a> <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2397173689&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:2397173689:41" alt="点击这里给我发消息" title="点击这里给我发消息"></a> <a target="_blank" href="msnim:chat?contact=sanmingzhi1@hotmail.com"><img height="23" alt="" width="81" border="0" src="http://www.sanmingzhi.com/static/index_img/online1.jpg" /></a> <a target="_blank" href="msnim:chat?contact=sanmingzhi2@hotmail.com"><img height="23" alt="" width="81" border="0" src="http://www.sanmingzhi.com/static/index_img/online1.jpg" /></a></p>'
			+ ' <p style="height:40px;"></p>'
			+ ' <p class="btn7" style=" margin:0 150px 0 0; float:right; display:inline;"><a href="javascript:online_ask_close()">关闭窗口</a></p>'
			+ '<p style="height:40px; clear:both"></p>'
			+ ' </div>'
			+ '</div>'
			+ '<img src="/static/co_img/detail08.png" width="538" height="16" border="0" />'
			+ '</div>';
	online_ask_ui = new swoole.Dialog('在线咨询', html, 540, 240, true, "");
	online_ask_ui.remove('all');
	online_ask_ui.show();
}

function consult() {
	var html = '<div class="npop">'
			+ '<div class="pop_nr">'
			+ '<div class="wz">'
			+ ' <p class="f16 bold">您可以点击以下按钮进行在线咨询，我们随时为您解答！</p>'
			+ ' <p style="padding-top:15px;"><a target="op" href="http://wpa.qq.com/msgrd?v=1&amp;uin=1502426575&amp;site=qq&amp;menu=yes"><img title="点击这里给我发消息" alt="点击这里给我发消息" border="0" src="http://wpa.qq.com/pa?p=2:1502426575:42" /></a> <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=1923364579&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:1923364579:42" alt="点击这里给我发消息" title="点击这里给我发消息"></a> <a target="_blank" href="msnim:chat?contact=sanmingzhi1@hotmail.com"><img height="23" alt="" width="81" border="0" src="http://www.sanmingzhi.com/static/index_img/online1.jpg" /></a> <a target="_blank" href="msnim:chat?contact=sanmingzhi2@hotmail.com"><img height="23" alt="" width="81" border="0" src="http://www.sanmingzhi.com/static/index_img/online1.jpg" /></a></p>'
			+ ' </div>' + '</div>' + '</div>';
	online_ask_ui = new swoole.Dialog('在线咨询', html, 400, 240, true, "");
	online_ask_ui.show();
}

function online_ask_close() {
	online_ask_ui.close();
}

function onOverMenu(obj) {
	obj.style.background = 'url(../enterimg/li_click00.gif)';
}
var flag = 0;
function mouseOv(id) {
	flag = 0;
	var tt = id.substring(3, 5);

	$("#" + id).attr("src", "images/left_nav_click" + tt + ".jpg");
}
function mouseOu(id) {
	if (flag == 0) {
		var tt = id.substring(3, 5);
		var rr = $("#" + id + "_content").css("display");
		if (rr == "none") {
			$("#" + id).attr("src", "images/left_nav" + tt + ".jpg");
		}
	}
}
function changeToRight(id) {
	flag = 1;
	var tt = id.substring(3, 5);
	var rr = $("#" + id + "_content").css("display");
	if (rr == "none") {
		$("#" + id).attr("src", "images/left_nav_click" + tt + ".jpg");
		$("#" + id + "_content")[0].style.display = "";
	} else {
		$("#" + id).attr("src", "images/left_nav" + tt + ".jpg");
		$("#" + id + "_content")[0].style.display = "none";
	}
}
function left_show(id) {
	for ( var i = 0; i < 6; i++) {
		if (i == id) {
			obj('nav' + i).className = 'lnav_on';
			obj('job' + i).style.display = 'block';
		} else {
			obj('nav' + i).className = 'lnav';
			obj('job' + i).style.display = 'none';
		}
	}
}
function showNext() {
	if (!validator_force('jobadd'))
		return false;
	document.getElementById("add_job_nr").style.display = "none";
	document.getElementById("add_job_nr_next").style.display = "";
}
function showUp() {
	document.getElementById("add_job_nr_next").style.display = "none";
	document.getElementById("add_job_nr").style.display = "";
}
function check_name(form_id, show_name, intro) {
	var value = document.getElementById(form_id).value;
	var value1 = document.getElementById(show_name).value;
	var value2 = document.getElementById(intro).value;
	jQuery
			.getJSON(
					'?c=runajax&v=jobexists',
					{
						'jobname' :value,
						'show_name' :value1,
						'enter_intro' :value2
					},
					function(exs) {
						if (exs == 1) {
							document.getElementById('j_name').innerHTML = '<span style=\"color:red;\">您已经发布过该职位！</span>';
							document.getElementById('j_name').style.display = "block";
						} else if (exs == 2) {
							document.getElementById('j_name').innerHTML = '<span style=\"color:red;\">职位名称不能为空！</span>';
							document.getElementById('j_name').style.display = "block";
						} else {
							document.getElementById('get_par').style.display = "none";
							document.getElementById('j_name').innerHTML = '<span style=\"color:green;\">该职位接受简历的邮箱是<input type=\"text\" name=\"g_email\" id=\"g_email\" value=\"' + exs.receive_email + '@sanmingzhi.com\" style=\"width:180px;\"><input type=\"button\" onclick=\"copyToClipboard(\'g_email\');\" value=\"复制\"></span>';
							document.getElementById('j_name').style.display = "block";
							document.getElementById('chose').href = '?c=es_cond&v=chose&jid=' + exs.jid;
							document.getElementById('chose').style.display = "block";
						}
					})
}

function setPagesize(pagesize) {
	var expiretime = new Date((new Date).getTime() + 3600 * 24 * 30);
	_Cookies.set('pagesize', pagesize, expiretime);
	urlto(window.location.href);
}
function popbox(id) {
	var newdiv = document.createElement("div");
	newdiv.style.position = "absolute";
	newdiv.style.top = "100px";
	newdiv.style.left = "0px";
	newdiv.style.height = "50px";
	newdiv.style.width = "150px";
	newdiv.style.backgroundColor = "#fff000";
	newdiv.className = "newdiv";
	id.appendChild(newdiv);// 将生成的div层插入到指定的节点内,成为其最后一个子节点；
}
function pageX(elem) {// 获取元素相对于整个文档的X位置的函数；
	var p = 0;
	while (elem.offsetParent) {
		p += elem.offsetLeft;
		elem = elem.offsetParent;
	}
	return p;
}
function pageY(elem) { // 获取元素相对于整个文档的Y位置的函数；
	var p = 0;
	while (elem.offsetParent) {
		p += elem.offsetTop;
		elem = elem.offsetParent;
	}
	return p;
}
/**
 * 显示简历操作界面
 */
function resume_ui(uid, erid, pipei, youxiao) {
	var msg = '你好啊是！<a href="?c=enterprise&amp;v=resume_detail&amp;uid={{$list[li].uid}}" target="_blank">';
	var tip_div = document.createElement('div');
	tip_div.className = 'Tip_div';
	var trigger = window.event.target;

	tip_div.style.cssText = "margin-left:" + trigger.offsetLeft
			+ 'px; margin-top:' + (trigger.offsetTop + trigger.offsetHeight)
			+ "px;width: 320px;";
	tip_div.style.height = '120px';
	tip_div.innerHTML = msg;
	document.body.appendChild(tip_div);
}

function add_tag() {
	if (!check_uids_value())
		return false;
	var users = obj('uids').value;
	obj('uids').value = '';
	if (users.length == 0) {
		alert('请选中您要操作的简历');
		return false;
	}
	var tag_select = '<div class="smz_select_02" style="float:left;">'
			+ '<input id="tag_select" type="hidden" name="tag_select" value="" />'
			+ '<input id="tag_select_text" class="txt02" type="text" value="请选择" />'
			+ '<input class="btn04" type="button" onclick="tag_select_js()" name="" />'
			+ '<div id="tag_select_options" class="smz_options" style="display: none;">'
			+ '<img border="0" src="/static/nback_img/tilbg19.gif">'
			+ '<div class="time_list_nr" id="tag_select_option" style="height:130px;">';
	for ( var i in taglist) {
		tag_select += '<span><a href="javascript:void(0);" onclick="chaTag(\''
				+ i + '\',\'' + taglist[i] + '\')">' + taglist[i]
				+ '</a></span>';
	}
	tag_select += '</div><img border="0" src="/static/nback_img/tilbg21.gif"></div></div>';
	/*
	 * var tag_select = '<select name="tag_select" id="tag_select">\n'; for (
	 * var i in taglist) { tag_select += '<option value="' + i + '">' +
	 * taglist[i] + '</option>\n'; } tag_select += '</select>';
	 */

	var input = '<span style="line-height:28px;float:left;">添加标签：</span><span style="float:left;"><input name="tagname" id="tagname" type="text" class="txt09" /></span><span style="float:right;"><input type="button" value="确定" style="float:left;margin:3px 5px 0 0" class="btn10" onclick="addtag();" /><input type="button" value="取消" style="margin-top:3px;" class="btn10" onclick="document.getElementById(\'new\').style.display=\'none\';" /></span><label style="clear:both"></label>';
	var click = '<span style="line-height:28px;color:#145E96;cursor:pointer;margin-left:30px;" onclick="document.getElementById(\'new\').style.display=\'block\';">添加新标签</span><label style="clear:both"></label>'
	var html = '<div class="tag_nr"><p><span style="line-height:28px;">现有标签：</span><span>'
			+ tag_select
			+ '</span>'
			+ click
			+ '<label style="clear:both"></label></p>'
			+ '<p id="new" style="display:none;">'
			+ input
			+ '</p><div style="clear:both"></div></div>';

	var btns = new swoole.Button('添加标签', function() {
		jQuery.post('/index.php?c=runajax&v=add_tag', {
			'users' :users,
			'tagid' :obj('tag_select').value
		}, function(data) {
			// alert(data);
				if (data == 1) {
					alert('添加标签成功！');
					closeFrame();
				} else {
					alert('添加失败！');
				}
			});
	});
	var ui = new swoole.Dialog('添加标签', html, 320, 160, true, [ btns ]);
	ui.show();
	return true;
}

function tag_select_js() {
	var obj = document.getElementById('tag_select_options');
	if (obj.style.display == 'none')
		obj.style.display = 'block';
	else
		obj.style.display = 'none';
}

function chaTag(k, v) {
	document.getElementById('tag_select').value = k;
	document.getElementById('tag_select_text').value = v;
	document.getElementById('tag_select_options').style.display = 'none';
}

function viewResult(id, show) {
	var html;
	var radio;
	var btns = new swoole.Button('提 交', function() {
		var rad = document.getElementsByName('result');
		var res;
		var content = document.getElementById('result_content').value;
		if (rad[0].checked)
			res = rad[0].value;
		else if (rad[1].checked)
			res = rad[1].value;
		else {
			alert('请选择是否考虑！');
			return false;
		}
		jQuery.getJSON('/index.php?c=runajax&v=viewResult', {
			'id' :id,
			'result' :res,
			'content' :content
		}, function(data) {
			if (data)
				location.reload(true);
			else {
				alert('添加失败！');
				return false;
			}
		});
	});
	var cancel = new swoole.Button('取 消', function() {
		ui.close();
	});
	if (show) {
		jQuery
				.getJSON(
						'/index.php?c=runajax&v=getViewresult',
						{
							'id' :id
						},
						function(date) {
							if (date != '') {
								if (date['result'] == 2)
									radio = '<input type="radio" name="result" value="2" checked />考虑<input type="radio" name="result" value="1" />不考虑';
								else
									radio = '<input type="radio" name="result" value="2" />考虑<input type="radio" name="result" value="1" checked />不考虑';
								html = '<div style="text-align:left; height:30px;">是否考虑：'
										+ radio
										+ '</div>'
										+ '<div sytle="clean:both;"><div style="float:left; height:60px;">面试结果：</div><textarea name="content" id="result_content" style="width:230px;height:60px;margin:0; padding:0; background-color:#fff;">'
										+ date['content'] + '</textarea></div>';
								var cancel = new swoole.Button('取 消',
										function() {
											ui.close();
										});
								var ui = new swoole.Dialog('面试结果', html, 350,
										300, true, [ btns, cancel ]);
								ui.show();
							}
						});
	} else {
		html = '<div style="text-align:left; height:30px;">是否考虑：<input type="radio" name="result" value="2" />考虑<input type="radio" name="result" value="1" />不考虑</div>' + '<div sytle="clean:both;"><div style="float:left; height:60px;">面试结果：</div><textarea name="content" id="result_content" value="" style="width:230px;height:60px;margin:0; padding:0; background-color:#fff;border:1px solid #8b99a4;"></textarea></div>';
		var ui = new swoole.Dialog('面试结果', html, 350, 300, true,
				[ btns, cancel ]);
		ui.show();
	}
	return true;
}

function addtag() {
	var v = document.getElementById('tagname').value;
	jQuery
			.post('/index.php?c=runajax&v=addtag',
					{
						'tagname' :v,
						'page_type' :page_type
					},
					function(data) {
						// alert(data);
					if (data == 1) {
						document.getElementById('tagname').focus();
						alert('添加失败！');
					} else {
						var html = $('#tag_select_option').html();
						html += '<span><a href="javascript:void(0);" onclick="chaTag(\''
								+ data
								+ '\',\''
								+ v
								+ '\')">'
								+ v
								+ '</a></span>';
						$('#tag_select_option').html(html);
						$('#tag_select_text').val(v);
						$('#tag_select').val(data);
						$('#new').hide();
					}
				});
}

function mess_send(codeid, code, jid) {
	jQuery
			.getJSON(
					'/index.php?c=runajax&v=get_mess',
					{
						'jid' :jid,
						'code' :code
					},
					function(data) {
						if (data == false) {
							alert('您的短信余额不足，无法发送短信！');
							return;
						}

						var tag_select = '<input type="text" name="mobile" id="mobile" vaule=""/>\n';

						var html = '<p class="bqxz"><label style="font-size:12px;">输入手机号：'
								+ tag_select
								+ '</label></p>'
								+ '<p class="bqxz"><label style="font-siez:12px;"><span style="float:left;height:60px;">短信内容：</span><label style="float:left;width:250px;" id="data">'
								+ data
								+ '</label></label></p><p style="clear:both;"></p>';

						var btns = new swoole.Button('发送', function() {
							var mobile = obj('mobile').value;
							if (mobile == '') {
								alert('手机号不能为空！');
								return;
							}
							if (isNaN(mobile)) {
								alert('请输入正确的手机号！');
								return;
							}
							if (mobile.length != 11) {
								alert('手机号位数不正确');
								return;
							}
							var data = obj('data').innerHTML;
							jQuery.post('/index.php?c=runajax&v=send_mess', {
								'mobile' :mobile,
								'jid' :jid,
								'data' :data,
								'codeid' :codeid
							}, function(res) {
								alert('发送成功');
								location.reload(true);
							});
						});
						var ui = new swoole.Dialog('发送短信', html, 350, 300,
								true, [ btns ]);
						ui.show();
						return true;
					});
}

function mail_send(codeid, code, jid) {
	var tag_select = '<input type="text" name="email" id="email" vaule=""/>\n';
	var a = '<a href="/enterprise/mail_sendkey/?code=' + escape(code) + '&jid='
			+ jid + '" target="_blank">浏览邮件内容</a>';
	var html = '<p class="bqxz"><label style="font-size:12px;">输入邮箱：'
			+ tag_select + '</label>' + a + '</p><p style="clear:both;"></p>';
	var btns = new swoole.Button('发送', function() {
		var email = obj('email').value;
		if (email == '') {
			alert('邮箱不能为空！');
			return;
		}
		if (!(/^[\w-\.]+@[\w-]+(\.(\w)+)*(\.(\w){2,4})$/).test(trim(email))) {
			alert('请输入正确的邮箱地址！');
			return;
		}
		jQuery.post('/enterprise/mail_sendkey/', {
			'email' :email,
			'codeid' :codeid,
			'code' :code,
			'jid' :jid
		}, function(res) {
			alert('发送成功');
			location.reload(true);
		});
	});
	var ui = new swoole.Dialog('发送邮件', html, 350, 300, true, [ btns ]);
	ui.show();
	return true;
}
/**
 * 测评邮件预览
 * 
 * @param secodeid
 * @param code
 * @param jid
 * @return
 */
function mail_preview(erid, show_enter, show_name, show_tel, show_person,
		job_intro, jid) {
	var enter_v = encodeURI(document.getElementById(show_enter).value);
	var name_v = encodeURI(document.getElementById(show_name).value);
	var tel_v = document.getElementById(show_tel).value;
	var person_v = encodeURI(document.getElementById(show_person).value);
	var intro_v = encodeURI(document.getElementById(job_intro).value);
	var jid_v = document.getElementById(jid).value;
	var html = '<iframe src="/index.php?c=enterprise&v=mail_preview&erid='
			+ erid + '&show_enter=' + enter_v + '&show_name=' + name_v
			+ '&show_tel=' + tel_v + '&show_person=' + person_v + '&job_intro='
			+ intro_v + '&jid=' + jid_v
			+ '"  width="800" height="500" frameborder="0">';
	var ui = new swoole.Dialog('发送测评邮件', html, 800, 500, true);
	ui.show();
	return true;
}
/**
 * 面试邮件预览
 * 
 * @param secodeid
 * @param code
 * @param jid
 * @return
 */
function face_preview() {
	var erid = document.getElementById('erid').value;
	var enter_v = encodeURI(document.getElementById('show_enter').value);
	var name_v = encodeURI(document.getElementById('show_name').value);
	var tel_v = document.getElementById('show_tel').value;
	var person_v = encodeURI(document.getElementById('show_person').value);
	var time_v = document.getElementById('face_time').value;
	var hour_v = document.getElementById('face_hour').value;
	var min_v = document.getElementById('face_min').value;
	var address_v = encodeURI(document.getElementById('face_address').value);
	var road_v = encodeURI(document.getElementById('face_road').value);
	var jid_v = document.getElementById('jid').value;
	if ((time_v == '') || (time_v == '0000-00-00')) {
		alert('通知面试时间不能为空！');
		return;
	}
	if (address_v == '') {
		alert('通知面试地点不能为空！');
		return;
	}
	var face_time = time_v + '日' + hour_v + '时' + min_v + '分';
	var html = '<iframe src="/index.php?c=enterprise&v=face_preview&erid='
			+ erid + '&show_enter=' + enter_v + '&show_name=' + name_v
			+ '&show_tel=' + tel_v + '&show_person=' + person_v + '&face_time='
			+ time_v + '&face_hour=' + hour_v + '&face_min=' + min_v
			+ '&face_address=' + address_v + '&face_road=' + road_v + '&jid='
			+ jid_v + '" width="800" height="500" frameborder="0">';
	var ui = new swoole.Dialog('发送面试邮件', html, 800, 500, true);
	ui.show();
	return true;
}
/**
 * 记录用户习惯
 */
function remb_uh(key, v) {
	var expiretime = new Date((new Date).getTime() + 3600 * 24 * 30);
	_Cookies.set('uh_' + key, v, expiretime);
}
/**
 * 添加手机号码
 * 
 * @param codeid
 * @param code
 * @param jid
 * @return
 */
function mobile_add(uid) {
	var tag_select = '<input type="text" name="mobile" class="txt06" id="mobile" vaule=""/>\n';

	var html = '<div class="tag_nr"><p style="height:40px;"><span style="line-height:28px;">输入手机号码：</span><span>' + tag_select + '</span><label style="clear:both"></label></p></div>';

	var ui;
	var btns = new swoole.Button('添加', function() {
		var mobile = obj('mobile').value;
		if (mobile == '') {
			alert('手机号不能为空！');
			return;
		}
		if (isNaN(mobile)) {
			alert('请输入正确的手机号！');
			return;
		}
		if (mobile.length != 11) {
			alert('手机号位数不正确');
			return;
		}
		jQuery.post('/index.php?c=runajax&v=mobile_add', {
			'mobile' :mobile,
			'uid' :uid
		}, function(res) {
			closeFrame();
			ui.close();
		});
	});
	ui = new swoole.Dialog('添加手机号码', html, 300, 100, true, [ btns ]);
	ui.show();
	return true;
}
/**
 * 进度条
 * 
 * @param codeid
 * @param code
 * @param jid
 * @return
 */
function sub_wait(stat) {
	var tag_select = '<img src="/static/images_require/07.gif">';

	var html = '<p style="padding-left:10px;">您的文件正在上传，这可能需要一些时间，请您耐心等候。。。</p><p><label style="font-size:12px;margin-left:20px;">' + tag_select + '</label></p>';

	var ui = new swoole.Dialog('上传文件', html, 250, 100, true, "");
	ui.remove("close");
	ui.remove("foot");
	if (stat == 't') {
		ui.show();
		return true;
	}
}
var progress_ui;
function ProgressBar(sub, oform) {
	sub.disabled = true;
	var html = '<iframe src="" name="postme" id="postme" width="320" height="70" scrolling="no" frameborder="0"></iframe>';
	progress_ui = new swoole.Dialog('正在更新报告匹配度', html, 320, 80, true);
	progress_ui.remove("close");
	progress_ui.remove("foot");
	progress_ui.show();

	obj(oform).target = 'postme';
	obj(oform).submit();
}
function ProgressBar_close() {
	progress_ui.close();
}

function ent_notice() {
	var html = '<div class="notice">' + _notice.content + "</div>";
	var dia = new swoole.Dialog(_notice.title, html, 610, 500, true);
	dia.show();
}

function send_code() {
	var job_select = '<select name="job_id" id="job_id" onchange="show_code(this.value)">\n';
	job_select += '<option value="">请选择</option>';
	for ( var i in joblist) {
		job_select += '<option value="' + joblist[i]['id'] + '">'
				+ joblist[i]['jobname'] + '</option>\n';
	}
	job_select += '</select>';

	var html = '<div class="tag_nr"><p><span style="line-height:28px;">选择职位：</span><span>'
			+ job_select
			+ '</span><label style="clear:both"></label></p>'
			+ '<p><span style="line-height:28px;">生成密钥：</span><span><input name="code" id="code" type="text" class="txt06" readonly /></span><label style="clear:both"></label></p>'
			+ '<p><span style="line-height:28px;">手机号码：</span><span><input name="mobile" id="mobile" type="text" class="txt06" />'
			+ '</span><label style="clear:both"></label></p><div style="clear:both"></div></div>';
	var btns = new swoole.Button('发送密钥', function() {
		var mobile = obj('mobile').value;
		if (/^1[3|4|5|8]\d{9}$/.test(mobile)) {
			jQuery.post('/index.php?c=runajax&v=send_code', {
				'job' :obj('job_id').value,
				'mobile' :obj('mobile').value,
				'code' :obj('code').value
			}, function(data) {
				data = eval('(' + data + ')');
				if (data == 1) {
					alert('发送成功！');
					location.reload(true);
				} else
					alert(data);
			});
		} else {
			alert('您输入的手机号有误！');
		}
	});
	var ui = new swoole.Dialog('发送密钥', html, 320, 160, true, [ btns ]);
	ui.show();
	return true;
}

function show_code(id) {
	jQuery.post('/index.php?c=runajax&v=show_code', {
		'job' :id
	}, function(data) {
		if (data) {
			obj('code').value = eval(data);
		}
	});
}

function cond_compare() {
	var v = getCheckboxValue('user[]');
	obj('uids').value = '';
	if (v.split(',').length > 6) {
		alert('最多只能选择5人候选人！');
		return false;
	}
	if (v == '') {
		alert('请选择要进行对比的候选人！');
		return false;
	} else {
		var html = '<iframe src="/enterprise/cond_compare/?uids=' + v + '" id="con" width="670" height="530" frameborder="0" scrolling="no"></iframe>';
		var btn = new swoole.Button('确定提交', function() {
			if (document.all) {// IE
					document.frames["con"].document.forms[0].submit();
				} else {// Firefox
					document.getElementById("con").contentDocument.forms[0]
							.submit();
				}
				dia.hide();
			});
		var dia = new swoole.Dialog('模板对比', html, 700, 610, true, [ btn ]);
		dia.show();
		return true;
	}
}
function isOpen(id) {
	var sp = 'sp_' + id;
	jQuery.post('/index.php?c=runajax&v=is_open', {
		'id' :id
	}, function(data) {
		if (data == 1) {
			alert('开启职位发布！');
			obj(sp).innerHTML = '发布中';
		} else if (data == 2) {
			alert('职位已关闭！');
			obj(sp).innerHTML = '已关闭';
		} else {
			alert('操作错误！');
		}
	});
}
function dim_compare() {
	var v = getCheckboxValue('user[]');
	obj('uids').value = '';
	if (v.split(',').length > 6) {
		alert('最多只能选择5人候选人！');
		return false;
	}
	if (v == '') {
		alert('请选择要进行对比的候选人！');
		return false;
	} else {
		var html = '<iframe src="/enterprise/dim_compare/?uids=' + v + '" id="dim" width="670" height="505" frameborder="0" scrolling="no"></iframe>';
		var btn = new swoole.Button('确定提交', function() {
			if (document.all) {// IE
					document.frames["dim"].document.forms[0].submit();
				} else {// Firefox
					document.getElementById("dim").contentDocument.forms[0]
							.submit();
				}
				dia.hide();
			});
		var dia = new swoole.Dialog('素质对比', html, 700, 610, true, [ btn ]);
		dia.show();
		return true;
	}
}
function check_uids_value() {
	var value = getCheckBoxValue('user[]');
	if (value.length != 0) {
		obj('uids').value = value;
		return true;
	} else if (obj('uids').value == '') {
		alert('请选择您要操作的对象！');
		return false;
	} else
		return true;
}
/**
 * 候选人操作（弹出层）
 * 
 * @param type
 * @return
 */
var op_dialog;
function operate_dialog(job) {
	if (!check_uids_value())
		return false;
	document.getElementById('job').value = job;
	var btn = new swoole.Button('确定提交', function() {
		if (document.all) {// IE
				document.frames["lotop"].document.forms[0].submit();
			} else {// Firefox
				document.getElementById("lotop").contentDocument.forms[0]
						.submit();
			}
			op_dialog.hide();
		});
	var cancel = new swoole.Button('取消操作', function() {
		op_dialog.close();
	});

	document.mainform.target = 'lotop';
	if (screen.height < 800)
		var fix = false;
	else
		fix = true;

	op_dialog = new swoole.Dialog(
			'操作',
			'<iframe height="500" frameborder="0" scrolling="no" width="550" id="lotop" name="lotop"></iframe>',
			584, 600, true, [ btn, cancel ], true, fix);
	op_dialog.show();
	document.mainform.submit();
	document.getElementById('uids').value = '';
	return true;
}
function operate_hide(job) {
	if (!check_uids_value())
		return false;
	document.getElementById('job').value = job;
	document.mainform.target = 'op';
	document.mainform.submit();
	document.getElementById('uids').value = '';
	return true;
}
function entTest() {
	var msg = '<iframe src="/enterprise/test_list/" width="780" height="500" scrolling="no" id="test" frameborder=0></iframe>';
	var dplan_dialog = new swoole.Dialog('试题界面', msg, 820, 540, true, '');
	dplan_dialog.remove('all');
	dplan_dialog.show();
}
function testClose() {
	$('.Dialog_bodybg').remove();
	$('.Dialog_none').remove();
}
function retest()
{
	jQuery.getJSON('/runajax/sample_test/',{'uid':prid},function(data){
		if(data==true) alert('邀请成功！您可以通知他登录个人测评系统进行抽样测试！');
		else alert('邀请失败！');
		});
}
