var celebrateBar = {

//获取对象
$$ : function(id){if(document.getElementById){return eval('document.getElementById("'+id+'")')}else{return eval('document.all.'+id)}},

//获取cookie
getAdCookie : function(name){var aCookie = document.cookie.split(";");try{for(var i=0; i<aCookie.length; i++){var aCrumb = aCookie[i].split("=");aCrumb[0] = aCrumb[0].replace(/^\s+/,'').replace(/\s+$/,'');if(aCrumb[0] == name) return aCrumb[1].replace(/^\s+/,'').replace(/\s+$/,'');}}catch(e){return false;}return false;},

//设置cookie
setAdCookie : function(name,value,path,domain,expires){document.cookie = name + "=" + value + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((expires) ?"; expires=Thu, 01-Jan-70 00:00:01 GMT" : "");},

//构造函数
init : function(){
	var self = this;
	try{
    document.write('\
      <style id="style1" type="text/css">\
        body{background:#FFF url(http://img.eol.cn/images/cer.net/index/sp2010/sp_eol_bg.jpg) no-repeat top center;padding-top:0;margin-top:0;}\
        .topAD{background:#fff;}\
        #wrap{padding-top:0;margin-top:0;}\
      </style>\
      <div id="2008TopBar" style="clear:both;width:910px;height:48px;margin:0 auto;padding:0;background:url(http://img.eol.cn/images/cer.net/index/sp2010/sp_910.jpg) no-repeat;overflow:hidden;position:relative;">\
        <div id="60Btncls" style="width:40px;height:18px;padding:0;margin:0;position:absolute;right:0;bottom:0;cursor:pointer;display:block;background:url(http://img.eol.cn/images/cer.net/index/guoq60/60_zty_cls1.jpg) no-repeat;z-index:2;" title="关闭背景"></div>\
      </div>\
      <div id="2008TopBlank" style="clear:both;height:5px;line-height:0;font-size:0;overflow:hidden;display:none;"></div>\
    ');

    var tmpImg = document.createElement("img");
    tmpImg.src="http://img.eol.cn/images/cer.net/index/guoq60/60_zty_cls2.jpg";

    this.$$("60Btncls").onmouseover = function(){self.$$("60Btncls").style.background = "url(http://img.eol.cn/images/cer.net/index/guoq60/60_zty_cls2.jpg) no-repeat";};
    this.$$("60Btncls").onmouseout = function(){self.$$("60Btncls").style.background = "url(http://img.eol.cn/images/cer.net/index/guoq60/60_zty_cls1.jpg) no-repeat";};
    this.$$("60Btncls").onclick = function(){
		document.body.style.background = "none";
		self.$$("2008TopBar").style.display = "none";
		self.$$("2008TopBlank").style.display = "block";
	    self.setAdCookie("60yearBgCookie",1,'/');
		self.changLoginBg(false);
	};
  }catch(e){}
},

changLoginBg : function(sign) {
	if(this.$$("e09_top")) {
		var e09_top = this.$$("e09_top");
		if(sign) {
			e09_top.style.backgroundImage = "url(http://img.eol.cn/images/cer.net/index/sp2010/eol_tnav_bg.jpg)";
			e09_top.style.color = "#ffffff";
			var childNodes = this.$$("loginDiv").children[0].children;
			for(var i=0;i<childNodes.length;i++){
				if(childNodes[i].tagName == 'A') childNodes[i].style.color = '#ffffff';
			}
			if(this.$$("_login")) this.$$("_login").style.color = '#ffffff';
			this.$$("e09top_c").children[0].style.color = '#ffffff';
			//alert(this.$$("e09top_c").style.background);
			this.$$("e09top_c").style.backgroundImage = "url(http://img.eol.cn/images/cer.net/index/sp2010/logo_cernet.jpg)";
			
		}else {
			e09_top.style.backgroundImage = "";
			e09_top.style.color = "";
			var childNodes = this.$$("loginDiv").children[0].children;
			for(var i=0;i<childNodes.length;i++){
				if(childNodes[i].tagName == 'A') childNodes[i].style.color = '#000000';
			}
			if(this.$$("_login")) this.$$("_login").style.color = '#000000';
			this.$$("e09top_c").children[0].style.color = '#000000';
			this.$$("e09top_c").style.backgroundImage = "url(http://www.eol.cn/include/eol/loc/images/logo2.jpg)";
		}
	}
}

}

var cookie = celebrateBar.getAdCookie("60yearBgCookie");
cookie = cookie?cookie:1;
if(cookie==1){celebrateBar.init();}
