var intervalId = null;    
function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){    
  this.stayTime=nStayTime*1000 || 3000;    
  this.maxHeigth=nMaxHth || 480;    
  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 + 2) : (h - 2))+"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,1);    
}   

var showad = true;
var Toppx = 60;    //上端位置
var AdDivW = 200;   //宽度
var AdDivH = 500;   //高度
var MinScreenW = 1024; //显示广告的最小屏幕宽度象素
var Borderpx = 10;   //广告距两边象素
var IsAutoScroll = false; //是否上面移动
var ClosebuttonHtml = '<div align="right" style="position: absolute;top:240px;right:0px;margin:2px;padding:2px;z-index:2000;"><a href="javascript :;" onclick="hidead()" style="color:red;text-decoration:none;font-size:12px;">关闭</a></div>'
var AdContentHtml = '<div align="center" style="top:20px;">';
AdContentHtml +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="200" height="500">';
AdContentHtml +='   <param name="movie" value="images/1.swf" />';
AdContentHtml +='    <param name="quality" value="high" />';
AdContentHtml +='   <embed id=dl src="images/1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="500">';
AdContentHtml +='   </embed>';
AdContentHtml +='</object></div>';
document.write ('<div id="Javascript.LeftDiv"   style="position: absolute;border: 0px solid #336699;background-color:#EEEEEE; top:20px; z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>');
document.write ('<div id="Javascript.RightDiv" style="position: absolute;border: 0px solid #336699;background-color:#EEEEEE; top:20px; z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>');
function scall(){
if(!showad){return;}
if (window.screen.width<=MinScreenW){
   //alert("临时提示：\n\n显示器分辨率宽度小于"+MinScreenW+",不显示广告");
   showad = false;
   document.getElementById("Javascript.LeftDiv").style.display="none";
   document.getElementById("Javascript.RightDiv").style.display="none";
   return;
}

document.getElementById("Javascript.LeftDiv").style.display="";
if(IsAutoScroll){
   document.getElementById("Javascript.LeftDiv").style.top=document.body.scrollTop+Toppx;
}
else{
   document.getElementById("Javascript.LeftDiv").style.top=Toppx;
}
document.getElementById("Javascript.LeftDiv").style.left=document.body.scrollLeft+Borderpx;
document.getElementById("Javascript.RightDiv").style.display="";
if(IsAutoScroll){
   document.getElementById("Javascript.RightDiv").style.top=document.body.scrollTop+Toppx;
}
else{
   document.getElementById("Javascript.RightDiv").style.top=Toppx;
}
document.getElementById("Javascript.RightDiv").style.left=document.body.scrollLeft+document.body.clientWidth-document.getElementById("Javascript.RightDiv").offsetWidth-Borderpx;
}

function hidead()
{
showad = false;
document.getElementById("Javascript.LeftDiv").style.display="none";
document.getElementById("Javascript.RightDiv").style.display="none";
}
window.onscroll=scall;
window.onresize=scall;
window.onload=scall;
scall()
