	var time = 500;
    var h = 0;
    var isadd=true;
    function addCount()
    {
        if(time>0)
        {
            time--;
            h = h+5;
        }
        else
        {
            return;
        }
        if(h>showheight)  //高度
        {
            return;
        }
        document.getElementById("ad").style.display = "";
        document.getElementById("ad").style.height = h+"px";
        if(isadd){
        	setTimeout("addCount()",30); 
        }else{
        	noneAds();
        }
    }
    
    var timer = false;
    window.onload = function showAds()
    {
        addCount();
        timer = setTimeout("noneAds()",showtime); //停留时间自己适当调整
    }
 
    var T = 500;
    var N = showheight; //高度
    function noneAds()
    {
        if(T>0)
        {
            T--;
            N = N-5;
        }
        else
        {
            return;
        }
        if(N<0)
        {
            document.getElementById("ad").style.display = "none";
            return;
        }
        
        isadd = false;
        
        document.getElementById("ad").style.height = N+"px";
        setTimeout("noneAds()",30); 
    }
    
    function closesjAds()
    {
    	if(isadd){
	    	N = h;
	    	if(timer){
	    		if(h>showheight)  //高度
		        {
		            clearTimeout(timer);
	        		noneAds();
		        }
	        }
	        isadd=false;
	    }
    }