//获取窗口元素ID
var showBox = document.getElementById("showbox");

//判断浏览器
if(document.all){
	setInterval(function(){
		var scrollTop=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
		showBox.style.top=document.documentElement.clientHeight+scrollTop-showBox.offsetHeight+'px';		
	},10);
}

//设置Cookie
function setCookie(name,value,time){
	 var exdate=new Date();
	 exdate.setTime(exdate.getTime()+time);
	 document.cookie=name+ "=" +escape(value)+((time==null) ? "" : "; expires="+exdate.toGMTString());
}

//获取Cookie
function getCookie(G) {
    var E = "" + document.cookie;
    var F = E.indexOf(G);
    if (E == "" || F == -1) {
        return "";
    }
    var H = E.indexOf(";", F);
    if (H == -1) {
        H = E.length;
    }
    return unescape(E.substring(F + G.length + 1, H));
}

//关闭窗口并设置Cookie
function closeBox(){
	showBox.style.display = "none";	
	setCookie("noticeBox","1",5*60*60*1000);
}

//检测Cookie
function checkCookie(){
	var myCookie = getCookie("noticeBox");
	if(!myCookie && showBox){
		showBox.style.display = "block";	
	}
}

checkCookie();
