﻿var time = 500;
var h = 0;
function addCount()
{
if(time>0)
	{
		time--;
		h = h+5;
	}
	else
	{
		return;
	}
	if(h>300)  //高度
	{
		return;
	}
	document.getElementById("move").style.display = "";
	document.getElementById("move").style.height = h+"px";
	setTimeout("addCount()",30); 
}

window.onload = function showAds()
{
	addCount();
	setTimeout("noneAds()",10000); //停留时间自己适当调整
}

var T = 260;
var N = 260; //高度
function noneAds()
{
	if(T>0)
	{
		T--;
		N = N-5;
	}
	else
	{
		return;
	}
	if(N<0)
	{
		document.getElementById("move").style.display = "none";
		return;
	}
	
	document.getElementById("move").style.height = N+"px";
	setTimeout("noneAds()",30); 
}

/*
var intervalId = null;    
function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){    
  this.stayTime=nStayTime*5000 || 3000;    
  this.maxHeigth=nMaxHth || 300;    
  this.minHeigth=nMinHth || 2.5;    
  this.state=sState || "down" ;    
  var obj = document.getElementById(id);    
  if(intervalId != null)window.clearInterval(intervalId);    
  function openBox(){    
   var h = obj.offsetHeight;    
   obj.style.height = ((this.state == "down") ? (h + 5) : (h - 5))+"px";    
    if(obj.offsetHeight>this.maxHeigth){    
    window.clearInterval(intervalId);    
    intervalId=window.setInterval(closeBox,this.stayTime);    
    }    
    if (obj.offsetHeight<this.minHeigth){    
    window.clearInterval(intervalId);    
    obj.style.display="none";
    }    
  }    
  function closeBox(){    
   slideAd(id,this.stayTime,"up",nMaxHth,nMinHth);    
  }    
  intervalId = window.setInterval(openBox,10);    
}
*/