$(document).ready(function() {
	$("#k").focus();
	$(document).find("a[id='top']").click(function(event){
		x = document.body.scrollLeft + event.clientX;
		y = document.documentElement.scrollTop + event.clientY;
		var layer = document.getElementById('layer1');
		layer.style.posLeft = x-250;
		layer.style.posTop = y-80;
		$("#layer1").show();
	});
	$("#closelayer1").click(function(){
		$("#layer1").hide();
	});
	
	$(document).find("a[id='del']").click(function(event){
		var id = $(this).attr("name");
		$("#del_id").val(id);
		x = document.body.scrollLeft + event.clientX;
		y = document.documentElement.scrollTop + event.clientY;
		var layer = document.getElementById('layer2');
		layer.style.posLeft = x-150;
		layer.style.posTop = y-80;
		$("#layer2").show();
	});
	$("#closelayer2").click(function(){
		$("#layer2").hide();
	});
});

function chkform(the) {
	if (!the.post.value) {
		alert('请输入岗位');
		the.post.focus();
		return false;
	}
	if (!the.persons.value) {
		alert('请输入招聘人数');
		the.persons.focus();
		return false;
	}
	if (!the.claim.value) {
		alert('请输入人员要求');
		the.claim.focus();
		return false;
	}
	if (!the.phone.value) {
		alert('请输入电话');
		the.phone.focus();
		return false;
	}
	if (!the.name.value) {
		alert('请输入姓名');
		the.name.focus();
		return false;
	}
//	if (!the.qq.value) {
//		alert('请输入QQ');
//		the.qq.focus();
//		return false;
//	}
	if (!the.company.value) {
		alert('请输入店面(公司)名称');
		the.company.focus();
		return false;
	}
	if (!the.addr.value) {
		alert('请输入地址');
		the.addr.focus();
		return false;
	}
	if (!the.safecode.value) {
		alert('请输入验证码');
		the.safecode.focus();
		return false;
	}
	if (!the.passwd.value) {
		alert('请输入删除密码');
		the.passwd.focus();
		return false;
	}
	return true;
}

function chkformJianli(the) {
	if (!the.post.value) {
		alert('请输入应聘的岗位');
		the.post.focus();
		return false;
	}
	if (!the.work_addr.value) {
		alert('请输入期待工作地点');
		the.work_addr.focus();
		return false;
	}
	if (!the.work_years.value) {
		alert('请输入工作经验');
		the.work_years.focus();
		return false;
	}
	if (!the.experience.value) {
		alert('请输入工作经验');
		the.experience.focus();
		return false;
	}
	
	if (!the.skill.value) {
		alert('请输入工作技能');
		the.skill.focus();
		return false;
	}
	if (!the.edu.value) {
		alert('请输入学历');
		the.edu.focus();
		return false;
	}
	if (!the.addr.value) {
		alert('请输入地址');
		the.addr.focus();
		return false;
	}
	if (!the.phone.value) {
		alert('请输入联系电话');
		the.phone.focus();
		return false;
	}
	if (!the.name.value) {
		alert('请输入联系人');
		the.name.focus();
		return false;
	}
	if (!the.qq.value) {
		alert('请输入QQ');
		the.qq.focus();
		return false;
	}
	
	if (!the.safecode.value) {
		alert('请输入验证码');
		the.safecode.focus();
		return false;
	}
	if (!the.passwd.value) {
		alert('请输入删除密码');
		the.passwd.focus();
		return false;
	}
	return true;
}

function chkDelForm(the) {
	if (the.passwd.value == '') {
		alert('请输入密码');
		return false;
	}
	return true;
}

function AddFavorite(sURL, sTitle){
    try    { 
	        window.external.addFavorite(sURL, sTitle);     
	} catch (e) {
		try {
			window.sidebar.addPanel(sTitle, sURL, "");
		} catch (e) {
			alert("加入收藏失败，请使用Ctrl+D进行添加"); 
		}
	}
}
function SetHome(obj,vrl){
	try{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(vrl);
	} catch(e) {
		if (window.netscape) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			} catch (e) {
				alert("此操作被浏览器拒绝！请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");
			} 
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);            prefs.setCharPref('browser.startup.homepage',vrl);
		}
	}
}
