var hmax = 716;//最大高度
var hmin = 1;//最小高度
var h=0;
function addCount(v){
	if(v==0){
		document.getElementById("ads").style.display = "block";
		document.getElementById("ads").style.height = h+"px";
		hmax=716;
	}else{
		document.getElementById("adsOPEN").style.display = "block";
		document.getElementById("adsOPEN").style.height = h+"px";
		hmax=50;
	}
	
	if(h<hmax){
		h += 5;
		setTimeout("addCount("+v+")",10); 
	}else{
		if(v==0){
			h=hmax;
			setTimeout("noneAds()",2000); //停留时间自己适当调整 1000 = 1秒
			document.getElementById("adsOPEN").style.display = "none";
		}	
	}
}
/*
window.onload = function showAds(){
	if(document.getElementById("adsOPEN")&&document.getElementById("ads")){
		document.getElementById("adsOPEN").style.display = "none";
		document.getElementById("ads").style.display = "none";
		document.getElementById("ads").style.height = "0px";
		addCount(0); //慢慢打开
	}
}*/
function openAds(){
	document.getElementById("adsOPEN").style.display = "none";
	h = 0;//高度
	addCount(0); //慢慢打开
}
function noneAds(){
	if(h>hmin)	{
		h -= 5;
		setTimeout("noneAds()",10); 
	}
	else {
		h = hmin;
		document.getElementById("ads").style.display = "none";
		document.getElementById("adsOPEN").style.height = "0px";
		document.getElementById("adsOPEN").style.display = "block";
		addCount(1);
	}
	document.getElementById("ads").style.height = h+"px";
}

function closeAd(){
	document.getElementById("ads").style.display = "none";
	document.getElementById("adsOPEN").style.display = "block";
	//showStart();
	}
function showAds(){//现在的方案
  
	if(document.getElementById("ads")){		
		document.getElementById("ads").style.display = "block";
		document.getElementById("adsOPEN").style.display = "none";
		setTimeout("closeAd()",5000); 
	}
	
	
}

function showAdsOPEN(){
  document.getElementById("adsOPEN").style.display = "block";	
}

if(showTopAd==0){
setTimeout("showAds()",1000)
}else{
	setTimeout("showAdsOPEN()",100); 
}

