var bubbleRemind = $Class({
    _displayDuration : 10000, //ms
    _ajaxDuration : 60000,   //ms
    
    $init:function()
    {
					this.popLayer = $("popLayer");
    			this.popLayer.style.display = "none";
		    	//û�е�½�û�����ʾ����
				if(typeof sLoginUserId == "undefined" || sLoginUserId == "") {
				    return;
				}

        this.durationTimer = null;
        this.fadeTimer = null;
        this.ajaxTimer = null;
        this._ajax = new SPS.Include();
        this.popLayer.style.opacity = 0;
		this.popLayer.style.filter = 'alpha(opacity=0)';
		this.currentIndex = 0;

		setTimeout($Fn(this._getNewData, this).bind(), 20);
		this._ajaxRequest();
			//this._showLayer();
    },
    
    _showLayer:function()
    {
        clearInterval(this.fadeTimer);
        clearInterval(this.ajaxTimer);
        clearInterval(this.durationTimer);
        this.popLayer.style.display = "block";
        this.fadeTimer = setInterval($Fn(this.fade, this).bind(1), 60);
        this.durationTimer = setTimeout($Fn(this._hideLayer, this).bind(), this._displayDuration);
    },
    
    _hideLayer:function()
    {
        clearInterval(this.fadeTimer);
        this.fadeTimer = setInterval($Fn(this.fade, this).bind(-1), 60);
        
    },
    _ajaxRequest:function()
    {
        this.ajaxTimer = setInterval($Fn(this._getNewData, this).bind(), this._ajaxDuration);
    },
    _getNewData:function()
    {
    	//Ajax submit
        var owner = this;
        //var sUrl = remindUrl + '?m=s';
        this._ajax.request(remindUrl, function(o) {owner.infoArray = o; owner._setNewData();});
    },
    _setNewData:function()
    {
        if(typeof this.infoArray == "undefined" || this.infoArray.length==0) return;
        
        var p = $$("p", this.popLayer)[0];
        p.innerHTML = decodeURIComponent(this.infoArray[this.currentIndex]);
        if(++this.currentIndex == this.infoArray.length)
        {
            this.currentIndex = 0;
            this.infoArray = void(0);
        }
        this._showLayer();
    },
    
    
    Alpha:0,
    Endalpha:95,
    speed:10,
    fade:function(d)
    {
    	var a = this.Alpha;
    	if((a != this.Endalpha && d == 1) || (a != 0 && d == -1))
    	{
    		var i = this.speed;
    		if(this.Endalpha - a < this.speed && d == 1)
    		{
    			i = this.Endalpha - a;
    		}
    		else 
    		    if(this.Alpha < this.speed && d == -1)
    		    {
    			    i = a;
    			}
    			
    		this.Alpha = a + (i * d);
    		this.popLayer.style.opacity = this.Alpha * 0.01;
    		this.popLayer.style.filter = 'alpha(opacity=' + this.Alpha + ')';
    	}
    	else
    	{
    		clearInterval(this.fadeTimer);
    		if(d == -1)
    		{
    		    this.popLayer.style.display = 'none';
    		    if(typeof this.infoArray == "undefined")
    		        this._ajaxRequest();
    		    else
    		        this._setNewData();
    		}
    	}
    }
    
});

