﻿// JavaScript Document

function ResumeError() { 
	return true; 
} 
window.onerror = ResumeError; 
function Fs(i){
	for(a = 1;a<=12;a++){
		if(a==i){
			var urlid = "url" + i;
			document.getElementById(i).style.background = "#528ACE";
			document.getElementById(urlid).style.color = "#FFFFFF";
		}else{
			var urlid = "url" + a;
			document.getElementById(a).style.background = "#ffffff";
			document.getElementById(urlid).style.color = "#185594";
		}
	}
}
function hideleft(){
	left.style.display="none";
	left.style.width = "0%";
	main.style.width = "1020px";
	left_img.innerHTML = '<img src="/images/leftbar_login_view.gif" width="15" height="92" style="cursor: hand;" onClick="showleft();">';
}
function showleft(){
	left.style.display="";
	left.style.width = "12%";
	main.style.width = "100%";
	left_img.innerHTML = '<img src="/images/leftbar_login.gif" width="15" height="92" style="cursor: hand;" onClick="hideleft();">';
}
function GetTextPosition(obj) 
{
    var objLeft = obj.offsetLeft;
    var objTop = obj.offsetTop;
    var objParent = obj.offsetParent;
    while (objParent.tagName != "BODY")
	{
        objLeft += objParent.offsetLeft;
        objTop += objParent.offsetTop;
        objParent = objParent.offsetParent;
    }
    return([objLeft,objTop]);
}
function ShowDiv(divid)
{
	var xy = GetTextPosition(document.getElementById("onlineUser"));
	document.getElementById("autocomplete").style.pixelLeft = xy[0]+30;
	document.getElementById("autocomplete").style.pixelTop = xy[1] + document.getElementById("onlineUser").offsetHeight;
	document.getElementById("autocomplete").style.pixelWidth = document.getElementById("onlineUser").offsetWidth;
	if (document.layers) {
	document.layers[divid].visibility="show";
	}else {
	document.getElementById(divid).style.visibility="visible";
	}
}

/**
 * 检查一个窗口是否被成功弹出,检查后调用一个指定的函数,调用成功返回true,失败返回false
 * 需要事先定义一个处理测试结果的函数,函数模型:funName(bCanPop)
 * Gage, 2004-6-15
 */
var checkWin = null;
function checkPopWin(objWin, strFunName)
{
	if(!strFunName) strFunName = "checkPopWin_DefaultFunction";
	if(typeof(eval(strFunName)) != "function") return false;
	checkWin = objWin;
	setTimeout("checkPopWin_CallBack(checkWin," + strFunName + ");",600);
	return true;
}
/**
 * 检查窗口回调函数
 */
function checkPopWin_CallBack(objWin, funFunction)
{
	if(!objWin || objWin.closed || typeof(objWin) != "object")
		funFunction(false);
	else
		funFunction(true);
	checkWin = null;
}
/**
 * 默认的窗口检查异常处理函数
 */
function checkPopWin_DefaultFunction(successful)
{
	if(successful)return;
	HTMLAlert("弹出的窗口被其它软件拦截了,操作不能继续!","注意",0,'250dis','160dis',true);
}

/**
 * 弹出一个层模拟window.alert.
 * 调用方法: HTMLAlert(<提示文字>,[提示标题],[自动关闭时间(单位毫秒|0为不自动关闭)],[距窗口左侧距离],[距窗口上侧距离],[是否是HTML文本])
 * Gage, 2004-6-10
 */
function HTMLAlert(text,title,clearTime,left,top,bHTMLCode)
{
	if(!document.body) return false;
	if(!text) text = "";
	if(!bHTMLCode) text = text.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/  /g,"&nbsp; ").replace(/\r\n/g,"<br>").replace(/\n/g,"<br>").replace(/\n/g,"<br>");
	if(!title) title = "CJOL.COM 提醒";
	var thisID = "T_" + Math.random().toString(16).replace(/0./,'');
	var leftPos = (document.body.clientWidth - 320) / 2;
	var topPos = (document.body.clientHeight - 30) / 2;
	var FromHTML = "<div onselectstart=\"return false;\" onkeydown=\"if(event.keyCode==13 || event.keyCode==27)this.outerHTML='';\" id=\"" + thisID + "\" style=\"position:absolute; top:220; left:" + leftPos + "; width:320; height:30; border:1 solid #244863;z-index:1000;background-color:#FFFFEE;\"><table width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" height=\"24\"><span style=\"height:100%; width:100%; border-bottom:1 solid #244863; background-color:#dee2ed\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" height=\"100%\"><tr><td align=\"left\" ><span style=\"font-size:14px;\">　" + title + "</span></td><td align=\"right\" style=\"padding:1px;\"><span style=\"border:1 solid #abb0ba; background-color:#dee2ed; cursor:hand;\" onclick=\"" + thisID + ".outerHTML='';\">&nbsp;X&nbsp;<span></td></tr></table></span></td></tr><tr><td style=\"padding:12px;\" valign=\"top\"><span style=\"font-size:12px;\">" + text + "</span></td></tr><tr><td align=\"center\" height=\"38\"><input onclick=\"" + thisID + ".outerHTML='';\" style=\"border:1 solid #abb0ba; background-color:#dee2ed;\" type=\"button\" value=\" 关 闭 \"></td></tr></table></div>";
	try
	{
		document.body.insertAdjacentHTML("BeforeEnd",FromHTML);
		if(left && !isNaN(left)) eval(thisID).style.posLeft = left + document.body.scrollLeft; else eval(thisID).style.posLeft = (document.body.clientWidth - eval(thisID).clientWidth) / 2 + document.body.scrollLeft;
		if(top && !isNaN(top)) eval(thisID).style.posTop = top + document.body.scrollTop; else eval(thisID).style.posTop = (document.body.clientHeight - eval(thisID).clientHeight) / 2 + document.body.scrollTop;
		setMove(eval(thisID));
	}
	catch(e){return false;}
	if(clearTime && !isNaN(clearTime))
	{
		try
		{
			setTimeout("try{" + thisID + ".outerHTML='';}catch(e){;}",clearTime);
		}
		catch(e){;}
	}
	return true;
}

/**
 * 设置一个对象使它支持鼠标拖动.
 * Gage, 2004-6-10
 */
function setMove(obj)
{
	obj.canMove = false;
	obj.lastLeft = null;
	obj.lastTop = null;
	obj.onmousedown = new Function("this.canMove = true;this.lastLeft = event.x;this.lastTop = event.y;");
	obj.onmouseup = new Function("this.canMove = false;");
	obj.onmousemove = new Function("if(!this.canMove) return;this.style.posLeft += (event.x - this.lastLeft);this.style.posTop += (event.y - this.lastTop);this.lastLeft = event.x;this.lastTop = event.y;");
	obj.onmouseout = new Function("this.canMove = false;");
	return true;
}

function init()
{
	try
	{
		window.name='UserCenter';
		window.focus();
		window.opener=null;
    	//window.resizeTo(850,580);
   	 	window.moveTo(0,0);
   	 	self.resizeTo(screen.availWidth,screen.availHeight);
	}
	catch(err)
	{
	;
	}
}

// Hide layer
function HideDiv(divid)
{
   if (document.layers) document.layers[divid].visibility="hide";
   else document.getElementById(divid).style.visibility="hidden";
}
function onAddGrp(target,title,Url,w,h,Fscroll)
{
	var iTop = (window.screen.availHeight-30-h)/2;       //获得窗口的垂直位置;
	var iLeft = (window.screen.availWidth-10-w)/2;        //获得窗口的水平位置;
	window.open(Url,target,'toolbar=no,center=yes,clocation=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top='+iTop+',left='+iLeft+',width='+ w +',innerWidth='+ w +',innerHeight='+ h +',height='+ h,title,'');
	//window.open('','UserCenter','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=790,height=545');
	/*window.scrollTo(5000,0);
	var sUrl = Url;
	var wnd = _bm2(target,title,sUrl,w,h);
	wnd._bsg().setScrolling(Fscroll);*/
}
function onMinGrp(target,title,Url,w,h,Fscroll){
	onAddGrp(target,title,Url,w,h,Fscroll);
	/*window.scrollTo(5000,0);
	var sUrl = Url;
	var wnd = _b0j(target,title,sUrl,w,h);
	wnd._bz6(false);
	wnd._bsg().setScrolling(Fscroll);*/
}
function onMaxGrp(target,title,Url,w,h,Fscroll){
	onAddGrp(target,title,Url,w,h,Fscroll);
	/*window.scrollTo(5000,0);
	var sUrl = Url;
	var wnd = _b0j(target,title,sUrl,w,h);
	wnd._bsg().setScrolling(Fscroll);*/
}
function openWin(src,winName,w,h){
	var iTop = (window.screen.availHeight-30-h)/2;       //获得窗口的垂直位置;
	var iLeft = (window.screen.availWidth-10-w)/2;        //获得窗口的水平位置;
	window.open(src,winName,'toolbar=no,center=yes,clocation=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top='+iTop+',left='+iLeft+',width='+ w +',innerWidth='+ w +',innerHeight='+ h +',height='+ h,'','');
}
function _login(t){
	//alert(t);
	if(t==0){
		onMaxGrp('com_center','企业招聘管理系统。version 1.0','/com/',850,580,'no');	
	}else if(t==1){
		onMaxGrp('person_center','个人求职系统。version 1.0','/person/',850,580,'no');
	}else if(t==2){
		onAddGrp('login','个人用户登入','/login/login.htm?target=login',400,280,'no');
	}else if(t==3){
		onAddGrp('register','个人注册简历','/person/register.htm',700,540,'no');
	}else if(t==4){
		onAddGrp('getPwd','用户取回密码','/login/login.htm?target=getPwd',400,280,'no');	
	}
}