﻿
var hmax = 400;//最大高度
var hmin = 105;//最小高度
var h=0;
function addCount(){
if(h<hmax){
  h += 5;
  setTimeout("addCount()",50); 
}
else {
  h=hmax;
  setTimeout("noneAds()",5000); //停留时间自己适当调整 1000 = 15秒
  document.getElementById("adsOPEN").style.display = "none";
}
document.getElementById("ads").style.display = "";
document.getElementById("ads").style.height = h+"px";
}
window.onload = function showAds(){
document.getElementById("ads").style.display = "none";
document.getElementById("ads").style.height = "0px";
openAds(); //慢慢打开
// h=hmax; 
// setTimeout("noneAds()",1500); //停留时间自己适当调整 1000 = 10秒
}
function openAds(){
h = 0;//高度
addCount(); //慢慢打开
}
function noneAds(){
if(h>hmin) {
  h -= 5;
  setTimeout("noneAds()",50); 
}
else {
  h = hmin;
  //document.getElementById("ads").style.display = "none";
  document.getElementById("adsOPEN").style.display = "";
  return;
}
document.getElementById("ads").style.height = h+"px";
}


document.onreadystatechange = subSomething;//当页面加载状态改变的时候执行这个方法. 
function subSomething() { 
if(document.readyState == "complete"){ //当页面加载状态为完全结束时进入
  openAds();
} 
} 

function hidden(id){  
   document.getElementById(id).style.display="none"; 
}

