window.onerror = killerror;
function killerror()
{
	return true;
}
var EncodeURI = function(unzipStr,isCusEncode){
    if(isCusEncode){
        var zipArray = new Array();
        var zipstr = "";
        var lens = new Array();
        for(var i=0;i<unzipStr.length;i++){
         var ac = unzipStr.charCodeAt(i);
         zipstr += ac;
         lens = lens.concat(ac.toString().length);
        } 
        zipArray = zipArray.concat(zipstr);
        zipArray = zipArray.concat(lens.join("O"));
        return zipArray.join("N");
    }else{
        //return encodeURI(unzipStr);
        var zipstr=""; 
        var strSpecial="!\"#$%&'()*+,/:;<=>?[]^`{|}~%"; 
        var tt= "";

        for(var i=0;i<unzipStr.length;i++){ 
            var chr = unzipStr.charAt(i); 
            var c=StringToAscii(chr); 
            tt += chr+":"+c+"n"; 
            if(parseInt("0x"+c) > 0x7f){ 
                 zipstr+=encodeURI(unzipStr.substr(i,1));
            }else{ 
                 if(chr==" ") 
                    zipstr+="+"; 
                 else if(strSpecial.indexOf(chr)!=-1) 
                    zipstr+="%"+c.toString(16); 
                 else 
                    zipstr+=chr; 
                } 
            } 
        return zipstr; 
    }
}

var DecodeURI = function(zipStr,isCusEncode){
    if(isCusEncode){
        var zipArray = zipStr.split("N");
        var zipSrcStr = zipArray[0];
        var zipLens;
        if(zipArray[1]){
            zipLens = zipArray[1].split("O");    
        }else{
            zipLens.length = 0;
        }
        
        var uzipStr = "";
        
        for(var j=0;j<zipLens.length;j++){
            var charLen = parseInt(zipLens[j]);
            uzipStr+= String.fromCharCode(zipSrcStr.substr(0,charLen));
            zipSrcStr = zipSrcStr.slice(charLen,zipSrcStr.length);
        }        
        return uzipStr;
    }else{
        //return decodeURI(zipStr);
        var uzipStr=""; 

        for(var i=0;i<zipStr.length;i++){ 
            var chr = zipStr.charAt(i); 
            if(chr == "+"){ 
                 uzipStr+=" "; 
            }else if(chr=="%"){ 
                 var asc = zipStr.substring(i+1,i+3); 
                 if(parseInt("0x"+asc)>0x7f){ 
                     uzipStr+=decodeURI("%"+asc.toString()+zipStr.substring(i+3,i+9).toString()); ; 
                     i+=8; 
                 }else{ 
                     uzipStr+=AsciiToString(parseInt("0x"+asc)); 
                     i+=2; 
                 } 
            }else{ 
                 uzipStr+= chr; 
            } 
        } 
        return uzipStr;
    }
}

var StringToAscii = function(str){
    return str.charCodeAt(0).toString(16);
}

var AsciiToString = function(asccode){
    return String.fromCharCode(asccode);
}

//扩展String的方法：Trim
String.prototype.Trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
function getCookie(name)//取cookies函数        
{
	var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
	if(arr && arr[2]) return arr[2]; return "";
}

function DelCookie(name){
	var exp = new Date();		
	exp.setTime(exp.getTime() - 1);
	document.cookie = name + "='';domain=;expires=" + exp.toGMTString();
	document.cookie = name + "='';domain=bjx.com.cn;expires=" + exp.toGMTString();	
}

function exitSystem_DelAllCookie(){
	var allCookie = document.cookie.split(";");
	for (var i=0; i<allCookie.length ; i++ ){
		try{
		var cookieName = allCookie[i].split("=")[0];
		//alert("'" + cookieName + "'");
		DelCookie(cookieName.Trim());
		}catch(e){}
	}
} 
function Login_P()
{		
	var CookieArr = "";
	var LogedId = "";
	var LogId = "";
	var ManagePage = "";
	var LoginMember = getCookie("HR.LoginMember");	
	if (LoginMember && LoginMember !="" && LoginMember!="undefined")
	{
		CookieArr = LoginMember.split("&");		
		if(CookieArr) 
		{
			LogedId = CookieArr[0].split("=")[1];
			LogId = CookieArr[1].split("=")[1];			
			ManagePage = "/hrsystem/default.aspx"
		}
		else
		{
			LogedId = "";
			LogId = "";
		}
	}			
    var login_TP;	
	if (LogedId=="" || LogId=="" || LogedId == null || LogId == null)
	{
			login_TP="1";
	}
	else
	{
		login_TP="0";
	}document.write("<style type='text/css'>.gerenfw{ font-size:12px; width:218px; border:1px #CCCCCC solid; height:130px!important; height:130px;; overflow:hidden;}.geren{ background:url(http://image.bjx.com.cn/hr/recom/gernfuwu.gif) no-repeat; width:218px; height:31px; overflow:hidden; margin-bottom:0!important; margin-bottom:-20px;}.leftshuru{ width:160px; height:50px; margin-top:0px; *margin-top:-10px; _margin-top:20px; overflow:hidden; float:left;}.leftshuru .fu{ float:left; height:24px; line-height:24px; width:50px; padding-left:5px; padding-bottom:5px;}.leftshuru .fu input { border:1px solid #CECECE; float:left; height:16px; width:95px;}.longin{ width:50px; height:44px; margin-left:160px; padding-top:5px; *padding-top:10px; _padding-top:22px; padding-bottom:8px;}.zwone{ float:left; margin-left:8px; *margin-left:5px; _margin-left:5px; padding-left:0px; *padding-left:5px; _padding-left:0px;}.zwtow{ float:left; margin-left:8px; *margin-left:0px; _margin-left:5px; padding-left:0px; *padding-left:5px; _padding-left:0px;}</style>");	
	if (login_TP=="1")
	{
document.write("<div class='gerenfw'><div class='geren'></div><form id='loginform' onsubmit='if (!loginform.username1.value || !loginform.password.value) return false;loginform.username.value=EncodeURI(loginform.username1.value);return true;' name='loginform' action='http://my.bjx.com.cn/login.aspx' method='post'><div class='leftshuru'><div class='fu'>会员名：</div><div class='fu'><input type='text' id='username1' name='username1' size='20' /><input type='hidden' name='username'/></div><div class='fu'>密&nbsp;&nbsp;码：</div>	<div class='fu'><input type='password' size='20' id='password' name='password' /></div></div><div class='longin'><input name='btnhrlogin' type='image' src='http://hr.bjx.com.cn/images/login.gif' /></div><div class='zwone'><a href='http://my.bjx.com.cn/register.aspx'><img src='http://hr.bjx.com.cn/images/vipzhuce.gif' border='0' /></a></div><div class='zwtow'><a href='http://my.bjx.com.cn/BackPassword.aspx' target='_blank'><img src='http://hr.bjx.com.cn/images/mima.gif' border='0' /></a></div><div class='clear'></div></form></div>");			}
	else
	{
		LogId = DecodeURI(escape(LogId));
		if(LogId.indexOf("%")>=0)
			LogId = DecodeURI(LogId);	
		document.write("<div class='gerenfw'><div class='geren'></div><div style='text-align:center; font-weight: bold; font-size:14px;margin-top:0px !important;margin-top:0px !important!;margin-top:18px ; padding-bottom:5px;'>个人会员</div><div style=' text-align:center; margin:16px auto; font-size:14px;'>欢迎<span style='color:#FF6600; font-size:16px;'>" + LogId + "</span>登录</div><div style='float:left; padding-left:57px;'><a href='"+ManagePage+"'><img width='71' height='20' border='0' align='absmiddle' src='http://hr.bjx.com.cn/images/jrgl.jpg'/></a></div><div style='float:left;'><a href='http://my.bjx.com.cn/loginout.aspx' ><img width='48' height='20' border='0' align='absmiddle' src='http://hr.bjx.com.cn/images/tuichu.jpg'/></a></div><div class='clear'></div></div>");
		
	} 
}
Login_P();
