
    var unlogin_time;
    var display_value;//判断checkbox的值
    var unlogin_t = 14400;//弹窗时间 秒为单位
	
	
function rununlogin(){//开始
display_value = 0;//开始给display_value赋值为0
if (getCookie("unlogin") !=null) {
unlogin_time=getCookie("unlogin");

if(unlogin_time < 0){ unlogin_time = unlogin_t;}

if(unlogin_time < unlogin_t + 10){
kc(unlogin_time);//如果Cookie-unlogin取到值就继续算
}

}else{
ldunlogin();//如果米有Cookie-unlogin值就赋值
}

}

function ldunlogin()//如果没有得到Cookie
{
	unlogin_time=getCookie("unlogin");
	if (unlogin_time ==null) 
	unlogin_time = unlogin_t;//给cookie一个定义值在顶上unlogin_t上设
	setTimeout("kc(unlogin_time)", 1000);//每秒回报一次cookie
	//alert(unlogin_time);
}
function kc(unlogin_time)//倒计时运算
{

 //var unlogin_time=escape (value);
 if(unlogin_time ==0){
 showPopup();//算到0的时候跳出窗口；并且停止倒计时
 display_value = 3;
 }else{
  if(display_value ==0){
  var unlogin_time=unlogin_time-1;//倒计时函数
 setCookie('unlogin',unlogin_time);
 ldunlogin();//算完一次返回
 }
 }
 
 }

function setCookie(name,value)
{
/*
 *--------------- setCookie(name,value) -----------------
 * setCookie(name,value) 
 * ??:?????name??
 * ??:name,???;value,???.
 * ??:setCookie('username','baobao')
 *--------------- setCookie(name,value) -----------------
 */
    var Days = 30; //此 cookie 将被保存 30 天
    var exp  = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
	//alert(unlogin_time);
	//document.f1.timespent.value = unlogin_time;
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
	
}

function getCookie(name)
{
/*
 *--------------- getCookie(name) -----------------
 * getCookie(name)
 * ??:????name??
 * ??:name,???.
 * ??:alert(getCookie("baobao"));
 *--------------- getCookie(name) -----------------
 */
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
    if(arr !=null) return unescape(arr[2]); return null;

}
//setCookie('unlogin',33)
//alert(getCookie("unlogin"));	
adCount=0;







function showPopup(){//弹窗函数
 MSG1.show();
}



<!--  
  
<!--  
  
/**//*  
**    ==================================================================================================  
**    类名：CLASS_MSN_MESSAGE  
**    功能：提供类似MSN消息框  
**    示例：  
    ---------------------------------------------------------------------------------------------------  
  
            var MSG = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示：","您有1封消息","今天请我吃饭哈");  
                MSG.show();  
  
    ---------------------------------------------------------------------------------------------------  
**    作者：ttyp  
**    邮件：ttyp@21cn.com  
**    日期：2005-3-18  
**    ==================================================================================================  
**/  
  
  
/**//*  
 *    消息构造  
 */  

function CLASS_MSN_MESSAGE(id,width,height,caption,title,message,target,action){  
    this.id     = id;  
    this.title  = title;  
    this.caption= caption;  
    this.message= message;  
    this.target = target;  
    this.action = action;  
    this.width    = width?width:500;  
    this.height =   height?height:520;  
    this.timeout= 18000;  
    this.speed    = 200; 
    this.step    = 1; 
    this.right    = this.width;  
    this.bottom =  screen.height; 
    this.left    = screen.width -1; 
    this.top    = this.bottom - this.height; 
    this.timer    = 0; 
    this.pause    = false;
    this.close    = false;
    this.autoHide  = true;
}  
  
/**//*  
 *    ??????  
 */  
CLASS_MSN_MESSAGE.prototype.hide = function(){  
    if(this.onunload()){  

        var offset  = this.height>this.bottom-this.top?this.height:this.bottom-this.top; 
        var me  = this;  
 
        if(this.timer>0){   
            window.clearInterval(me.timer);  
        }  
 
        var fun = function(){  
            if(me.pause==false||me.close){
                var x  = me.left; 
                var y  = 0; 
                var width = me.width; 
                var height = 0; 
                if(me.offset>0){ 
                    height = me.offset; 
                } 
     
                y  = me.bottom - height; 
     
                if(y>=me.bottom){ 
                    window.clearInterval(me.timer);  
                    me.Pop.hide();  
                } else { 
                    me.offset = me.offset - me.step;  
                } 
                me.Pop.show(x,y,width,height);    
            }             
        }  
 
        this.timer = window.setInterval(fun,this.speed)      
    }  
}  
  
/**//*  
 *    ??????,????  
 */  
CLASS_MSN_MESSAGE.prototype.onunload = function() {  
    return true;  
}  
/**//*  
 *    ??????,????????,????  
 *  
 */  
CLASS_MSN_MESSAGE.prototype.oncommand = function(){  
    this.close = true;
    this.hide();  
}  
  
/**//*  
 *    ??????  
 */  
CLASS_MSN_MESSAGE.prototype.show = function(){  

    var oPopup = window.createPopup(); //IE5.5+  
    
    this.Pop = oPopup;  
  
    var w = this.width;  
    var h = this.height;  

    var
	
	
	 
	    str = "<DIV style='WIDTH: " + w + "px; HEIGHT: " + h + "px;' class='message'>"
        str += "<table width='100%' border='0' cellspacing='0' cellpadding='0' style=' border:2px solid #E2EAFF' height=" + (h-28) + "><tr><td>"
		str += "<table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#EAEFFB' style='border:1px solid #9AA7C7'><tr>"
		str += "<td width='100%' height='31' background='http://images.mmosite.com/bbs/images/winbg.gif' style='font-size:12px;color:FFF;padding-left:15px;'>" + this.caption + "</td>"
		str += "<td width='70' background='http://images.mmosite.com/bbs/images/winbg.gif'><SPAN title=close style=' FONT-SIZE: 12px; CURSOR:hand;  font-weight:bold; COLOR: #fff; MARGIN-RIGHT: 4px' id='btSysClose' >Close</SPAN></td></tr>"
		str += "<tr><td colspan='2' style='font-size:14px;color:#2A52A5;font-weight:bold; padding:5px' align='center'>" + this.title + "</td></tr><tr>"
		str += "<td colspan='2'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td width='25%'><img src='http://images.mmosite.com/bbs/images/forum/80x107.jpg' width='80' style='margin:10px; border:2px solid #8E9BBB'></td><td width='75%' align='left' style='font-size:14px;color:000;' ><A href='javascript:void(0)' hidefocus=true id='btCommand'></a>" + this.message + "<br>"
		str += "<div align='center' style='font-size:14px;color:#2A52A5; font-weight:bold;'><input type='checkbox' id='checkbox2'>Never Show this window again!</div>"
        str += "</td></tr></table></td></tr><tr><td colspan='2' align='center'><br><table width='70%' border='0' cellspacing='0' cellpadding='0'><tr>"
		str += "<td width='95' height='25' align='center' background='http://images.mmosite.com/bbs/images/winbuttom.gif'><a id='home' style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: #fff;'>Home</a></td>"
		str += "<td>&nbsp;</td><td width='95' height='25' align='center' background='http://images.mmosite.com/bbs/images/winbuttom.gif'>"
		str += "<A id='reg' style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: #fff;'>Sign Up</A>"
		str += "</td><td>&nbsp;</td><td width='95' height='25' align='center' background='http://images.mmosite.com/bbs/images/winbuttom.gif'>"
		str += "<A id='login' style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: #fff;'>Sign In</A> </td></tr></table><br></td></tr></table></td></tr></table></DIV>"
  
    oPopup.document.body.innerHTML = str; 
    
  
    this.offset  = 0; 
    var me  = this;  

    oPopup.document.body.onmouseover = function(){me.pause=true;}
    oPopup.document.body.onmouseout = function(){me.pause=false;}

    var fun = function(){  
        var x  = me.left; 
        var y  = 0; 
        var width    = me.width; 
        var height    = me.height; 
 
            if(me.offset>me.height){ 
                height = me.height; 
            } else { 
                height = me.offset; 
            } 
 
        y  = me.bottom - me.offset; 
        if(y<=me.top){ 
            me.timeout--; 
            if(me.timeout==0){ 
                window.clearInterval(me.timer);  
                if(me.autoHide){
                    me.hide(); 
                }
            } 
        } else { 
            me.offset = me.offset + me.step; 
        } 
        me.Pop.show(x,y,width,height);    
 
    }  
  
    this.timer = window.setInterval(fun,this.speed)      
  
    var newwin = oPopup.document.getElementById("home");  
	
	newwin.onclick = function(){ window.open("http://forum.mmosite.com/", "_blank"); }
	
	var newreg = oPopup.document.getElementById("reg");  
	
	newreg.onclick = function(){ window.open("http://forum.mmosite.com/port/reg.php", "_blank"); }
  
  	var newlogin = oPopup.document.getElementById("login");  
	
	newlogin.onclick = function(){ window.open("http://forum.mmosite.com/login.php", "_blank"); }
	
	var admin = oPopup.document.getElementById("admin");  
	
	admin.onclick =function(){  window.open("http://forum.mmosite.com/show_userinfo.php?user=zwkl100", "_blank"); }
	
    var btClose = oPopup.document.getElementById("btSysClose");  
  
    btClose.onclick = function(){  
		closePopup();
    }  
	
	function closePopup(){//关闭弹窗div可视的值

        me.close = true;
        me.hide();  		

 var checkboxin = oPopup.document.getElementById("checkbox2");  
  
checkboxin.onclick = function(){  
unlogin_time = unlogin_t;
setCookie('unlogin',unlogin_t+10);
    }   


if(display_value!= 1){//如果在没勾不再显示input后关闭
unlogin_time = unlogin_t;//unlogin_time和cookie都设为初始值
setCookie('unlogin',unlogin_t);
var display_value = 0;
kc(unlogin_time);//取到checkbox的函数之后开始倒计时
}

}

      var btCommand = oPopup.document.getElementById("btCommand");  
    btCommand.onclick = function(){  
        me.oncommand();  
    }  
 
}  
/**//* 
** 设置速度方法 
**/ 
CLASS_MSN_MESSAGE.prototype.speed = function(s){ 
    var t = 200; 
    try { 
        t = praseInt(s); 
    } catch(e){} 
    this.speed = t; 
} 
/**//* 
** 设置步长方法 
**/ 
CLASS_MSN_MESSAGE.prototype.step = function(s){ 
    var t = 1; 
    try { 
        t = praseInt(s); 
    } catch(e){} 
    this.step = t; 
} 
  
CLASS_MSN_MESSAGE.prototype.rect = function(left,right,top,bottom){ 
    try { 
        this.left        = left    !=null?left:this.right-this.width; 
        this.right        = right    !=null?right:this.left +this.width; 
        this.bottom        = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height; 
        this.top        = top    !=null?top:this.bottom - this.height; 
    } catch(e){} 
} 
var MSG1 = new CLASS_MSN_MESSAGE("aa",448,255,"Forum message","Join our community and enjoy your time around MMOsite!","Hi, this is Forum Admin <a id='admin' style='color:#F78001; font-weight:bold; CURSOR: hand;'>daimon_hunter</a> here. I notice that you\'ve been hanging around MMOsite for a while. I think you might be interested in <span style='color:red;font-weight:bold;'>joining us to be a mmositer?</span> Thx for coming by, and wish you have a great time here.");  
    MSG1.rect(null,null,null,screen.height-50); 
    MSG1.speed    = 10; 
    MSG1.step    = 5; 
    //alert(MSG1.top); 
 
 
//同时两个有闪烁，只能用层代替了，不过层不跨框架 
//var MSG2 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示：","您有2封消息","好的啊");  
//   MSG2.rect(100,null,null,screen.height); 
//    MSG2.show();  
//--> 
