function Cookie(){
  this.SetValue=function(name,value,hours,path,domain){
    var str=new String();
    var nextTime=new Date();
    nextTime.setHours(nextTime.getHours()+hours);
    str=name+"="+escape(value);
    if(hours)
      str+=";expires="+nextTime.toGMTString();
    if(path)
      str+=";path="+path;
    if(domain)
      str+=";domain="+domain;
    document.cookie=str;
    }
  this.GetValue=function(name){
    var rs=new RegExp("(^|)"+name+"=([^;]*)(;|$)","gi").exec(document.cookie),tmp;
    if(tmp=rs)
      return unescape(tmp[2]);
    return null;
    }
}
if(typeof __info == "undefined"){
	__info={};
}
function doWithInfo(f){
	try{
		if(__info)
		 return	f.call(__info);
	}
	catch(e){}
}

var ck=new Cookie(); 
var uname=null;
if(typeof nb != "undefined")
	uname=nb.displayname;
if(typeof uname == "undefined" || uname==null) uname=ck.GetValue("username");
var authvalue =ck.GetValue("authvalue");
var libid = null;
if(typeof nb != "undefined")
    libid = nb.libid;
var userid = ck.GetValue("userid");

function __w(s){document.write(s);}
__w("<div id=\"head\">");
__w("<div id=\"h_right\">");
if(uname!=null){	
__w("欢迎 "+uname+" | ");
if(authvalue && parseInt(authvalue) !=0 && (parseInt(authvalue) & ~(128|512|64|8192))!=0 ){
	__w('<a href="http://www.nbdl.gov.cn/abo/libManager/statistics.html">后台管理</a> | ');	
}
__w("<a href=\"http://www.nbdl.gov.cn/abo/useredit/goeditpwd.action\">账号管理</a> | ");
__w("<a href=\"http://www.nbdl.gov.cn/abo/login/querybind.action\">账号绑定</a> | ");
__w("<a target=\"_parent\"  href=\"http://first.nbdl.gov.cn/DSRAppMList.jsp\">我的咨询</a> | ");
__w("<a href=\"http://www.nbdl.gov.cn/abo/logout.jsp\">退出登录</a>");
}
else{	
	__w('<a href=\"http://www.nbdl.gov.cn/abo/login/login.action\">登录</a> | <a href=\"http://www.nbdl.gov.cn/abo/reg/register.action\">注册</a>');
};
__w("</div>");

__w("<div id=\"h_left\"> <a href=\"http://www.nbdl.gov.cn/\" target=\"_parent\">首页</a>");

if(typeof libid == "undefined" || libid == null){
	if(typeof userid == "undefined" || userid == null)
	{
		__w(" | <a href=\"http://www.nbdl.gov.cn/abo/login/login.action\" target=\"_parent\">我的图书馆</a>");
	}
	else if(authvalue && (parseInt(authvalue) & 512)==0 )
	{
		__w(" | <a href=\"http://www.nbdl.gov.cn/abo/user/activelib.jsp\" target=\"_blank\">我的图书馆</a>");
	}
}
else if(authvalue && (parseInt(authvalue) & 512)==0 ){
	__w(" | <a href=\"http://www.nbdl.gov.cn/abo/useredit/gotolib.action?libid=" + libid + "\" target=\"_blank\">我的图书馆</a>");
}

__w("</div>");
__w("</div>");
__w("<div style='position:absolute; right:20px; top:27px;'>");
doWithInfo(function(info){
	try{
		if(__info.inipside && __info.ip){
			if(typeof nb != "undefined" && nb.schoolid && parseInt(nb.schoolid)>0){
				__w("欢迎来自"+nb.schoolname+"的朋友!");
			}
			if(!__info.inipside){
				__w("您不在宁波市ip范围内,");
			}
			__w(" 您现在的IP是:"+__info.ip);
		}
	}catch(e){}
});
__w("</div>");
