﻿/*	$id: expand.js top of website expand ad script*/var intervalId = null; function slideAd(id,nStayTime,sState,nMaxHth,nMinHth,ctrlId){   this.stayTime=nStayTime*1000 || 3000;   this.maxHeigth=nMaxHth || 400;   this.minHeigth=nMinHth || 1;   this.state=sState || "down" ;  var obj = document.getElementById(id);   var ctrlObj = document.getElementById(ctrlId) || null;    if(intervalId != null)window.clearInterval(intervalId);    function openBox(){    var h = obj.offsetHeight;    obj.style.height = ((this.state == "down") ? (h + 2) : (h - 4))+"px";   ctrlObj.style.display = (this.state == "down") ? "block" : "none";   //ctrlObj.innerHTML = (this.state == "down") ? "关闭" : "展开";      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(){	ctrlObj.style.display = "none";	slideAd(id,this.stayTime,"up",nMaxHth,nMinHth,ctrlId);   }	if(ctrlObj.addEventListener){		 ctrlObj.addEventListener("click",closeBox, false);	}else if(ctrlObj.attachEvent){		ctrlObj.attachEvent("onclick",closeBox);	}    intervalId = window.setInterval(openBox,1); } 
