function ObjectAD() {
  /* Define Variables*/
  this.ADID        = 0;
  this.ADType      = 0;
  this.ADName      = "";
  this.ImgUrl      = "";
  this.ImgWidth    = 0;
  this.ImgHeight   = 0;
  this.FlashWmode  = 0;
  this.LinkUrl     = "";
  this.LinkTarget  = 0;
  this.LinkAlt     = "";
  this.Priority    = 0;
  this.CountView   = 0;
  this.CountClick  = 0;
  this.InstallDir  = "";
  this.ADDIR       = "";
}

function MoveZoneAD(_id) {
  /* Define Common Variables*/
  this.ID          = _id;
  this.ZoneID      = 0;
  this.ZoneName    = "";
  this.ZoneWidth   = 0;
  this.ZoneHeight  = 0;
  this.ShowType    = 1;
  this.DivName     = "";
  this.Div         = null;

  /* Define Unique Variables*/
  this.Left        = 0;
  this.Top         = 0;
  this.Delta       = 0.15;

  /* Define Objects */
  this.AllAD       = new Array();
  this.ShowAD      = null;

  /* Define Functions */
  this.AddAD       = MoveZoneAD_AddAD;
  this.GetShowAD   = MoveZoneAD_GetShowAD;
  this.Show        = MoveZoneAD_Show;
  this.Move        = MoveZoneAD_Move;

}

function MoveZoneAD_AddAD(_AD) {
  this.AllAD[this.AllAD.length] = _AD;
}

function MoveZoneAD_GetShowAD() {
  if (this.ShowType > 1) {
    this.ShowAD = this.AllAD[0];
    return;
  }
  var num = this.AllAD.length;
  var sum = 0;
  for (var i = 0; i < num; i++) {
    sum = sum + this.AllAD[i].Priority;
  }
  if (sum <= 0) {return ;}
  var rndNum = Math.random() * sum;
  i = 0;
  j = 0;
  while (true) {
    j = j + this.AllAD[i].Priority;
    if (j >= rndNum) {break;}
    i++;
  }
  this.ShowAD = this.AllAD[i];
}

function MoveZoneAD_Show() {
  if (!this.AllAD) {
    return;
  } else {
    this.GetShowAD();
  }

  if (this.ShowAD == null) return false;
  this.DivName = "MoveZoneAD_Div" + this.ZoneID;
  if (!this.ShowAD.ImgWidth) this.ShowAD.ImgWidth = this.ZoneWidth
  if (!this.ShowAD.ImgHeight) this.ShowAD.ImgHeight = this.ZoneHeight
  if (this.ShowAD.ADDIR=="") this.ShowAD.ADDIR = "AD"

  document.write("<div id='" + this.DivName + "' style='position:absolute; visibility:visible; z-index:1; width:" + this.ZoneWidth + "px; height:" + this.ZoneHeight + "px; left:" + this.Left + "px;top:" + this.Top + "px'>" + AD_Content(this.ShowAD) + "</div>");
  if (this.ShowAD.CountView) {
    document.write ("<script src='" + this.ShowAD.InstallDir + this.ShowAD.ADDIR + "/ADCount.asp?Action=View&ADID=" + this.ShowAD.ADID + "'></script>")
  }
  this.Div = document.getElementById(this.DivName);
  setInterval(this.ID + ".Move()", 10);
}

function MoveZoneAD_Move() {
  if(document.all)  {
    pageX=document.body.scrollLeft;
    pageY=document.body.scrollTop;
  } 
  else  {
    pageX=window.pageXOffset;
    pageY=window.pageYOffset;
  }
  if (this.Div.offsetLeft != (pageX + this.Left)) {
    var dx = (pageX + this.Left - this.Div.offsetLeft) * this.Delta;
    dx = (dx > 0 ? 1 :  - 1) * Math.ceil(Math.abs(dx));
    this.Div.style.left = this.Div.offsetLeft + dx + "px";
  }

  if (this.Div.offsetTop != (pageY + this.Top)) {
    var dy = (pageY + this.Top - this.Div.offsetTop) * this.Delta;
    dy = (dy > 0 ? 1 :  - 1) * Math.ceil(Math.abs(dy));
    this.Div.style.top = this.Div.offsetTop + dy + "px";
  }
  this.Div.style.display = '';
}

function AD_Content(o) {
  var str = "";
  if (o.ADType == 1 || o.ADType == 2) {
  imgurl = o.ImgUrl .toLowerCase()
    if (o.InstallDir.indexOf("http://") != - 1) imgurl = o.InstallDir.substr(0, o.InstallDir.length - 1) + imgurl;
    if (imgurl.indexOf(".swf") !=  - 1) {
      str = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'";
      str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";
      str += " width='" + o.ImgWidth + "px'";
      str += " height='" + o.ImgHeight + "px'";
      if (o.style) str += " style='" + o.style + "'";
      if (o.extfunc) str += " " + o.extfunc + " ";
      str += ">";
      str += "<param name='movie' value='" + imgurl + "'>";
      if (o.FlashWmode == 1) str += "<param name='wmode' value='Transparent'>";
      if (o.play) str += "<param name='play' value='" + o.play + "'>";
      if (typeof(o.loop) != "undefined") str += "<param name='loop' value='" + o.loop + "'>";
      str += "<param name='quality' value='autohigh'>";
      str += "<embed ";
      str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";
      str += " width='" + o.ImgWidth + "px'";
      str += " height='" + o.ImgHeight + "px'";
      if (o.style) str += " style='" + o.style + "'";
      if (o.extfunc) str += " " + o.extfunc + " ";
      str += " src='" + imgurl + "'";
      if (o.FlashWmode == 1) str += " wmode='Transparent'";
      if (o.play) str += " play='" + o.play + "'";
      if (typeof(o.loop) != "undefined") str += " loop='" + o.loop + "'";
      str += " quality='autohigh'"
      str += " pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'></embed>";
      str += "</object>";
    } else if (imgurl.indexOf(".gif") !=  - 1 || imgurl.indexOf(".jpg") !=  - 1 || imgurl.indexOf(".jpeg") !=  - 1 || imgurl.indexOf(".bmp") !=  - 1 || imgurl.indexOf(".png") !=  - 1) {
      if (o.LinkUrl) {
        if (o.CountClick) o.LinkUrl = o.InstallDir + o.ADDIR + "/ADCount.asp?Action=Click&ADID=" + o.ADID
        str += "<a href='" + o.LinkUrl + "' target='" + ((o.LinkTarget == 0) ? "_self" : "_blank") + "' title='" + o.LinkAlt + "'>";
      }
      str += "<img ";
      str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";
      if (o.style) str += " style='" + o.style + "'";
      if (o.extfunc) str += " " + o.extfunc + " ";
      str += " src='" + imgurl + "'";
      if (o.ImgWidth) str += " width='" + o.ImgWidth + "px'";
      if (o.ImgHeight) str += " height='" + o.ImgHeight + "px'";
      str += " border='0'>";
      if (o.LinkUrl) str += "</a>";
    }
  } else if (o.ADType == 3 || o.ADType == 4) {
    str = o.ADIntro
  } else if (o.ADType == 5) {
    str = "<iframe id='" + "AD_" + o.ADID + "' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no width=100% height=100% src='" + o.ADIntro + "'>wait</iframe>";
  }
  return str;
}
var ZoneAD_4 = new MoveZoneAD("ZoneAD_4");
ZoneAD_4.ZoneID      = 4;
ZoneAD_4.ZoneWidth   = 368;
ZoneAD_4.ZoneHeight  = 60;
ZoneAD_4.ShowType    = 1;
ZoneAD_4.Left        = 1;
ZoneAD_4.Top         = 200;
ZoneAD_4.Delta       = 0.015;

var objAD = new ObjectAD();
objAD.ADID           = 7;
objAD.ADType         = 4;
objAD.ADName         = "第二十二届省运会倒计时牌";
objAD.ImgUrl         = "";
objAD.InstallDir     = "/";
objAD.ImgWidth       = 0;
objAD.ImgHeight      = 0;
objAD.FlashWmode     = 0;
objAD.ADIntro        = "<!-倒计时代码开始-!>\n\r<DIV align=center id=floater style=\"HEIGHT: 100px; WIDTH: 110px\">\n\r\n\r            <TABLE width=110 border=0 \n\r            cellPadding=0 cellSpacing=0 id=ad1>\n\r             <TBODY>\n\r             <TR>\n\r              <TD width=110 height=171 align=\"center\" valign=\"middle\" background=\"images/shengyun.jpg\">\n\r                <TABLE width=110 \n\r            cellPadding=2 cellSpacing=0 id=ad1>\n\r                  <TBODY>\n\r				  <tr><td height=\"81\">&nbsp;</td>\n\r				  </tr>\n\r                    <TR>\n\r                      <TD width=110 align=\"center\" valign=\"top\">\n\r                        <div class=\"style6\"></div>\n\r                        <div align=center>\n\r                          <div class=\"style3\" id=\"TimeCounter\" style=\"border:0px solid #000000; margin:0px; margin-left: 36px;width:72px; height:30px font-size: 12px;\"></div>\n\r                          <SCRIPT language=javascript>\n\r<!--\n\r//document.write(\"\");\n\r\n\rfunction show_date_time(){\n\rwindow.setTimeout(\"show_date_time()\", 1000);\n\rtarget=new Date(2010,8,20,0,0,0);\n\rtoday=new Date();\n\rtimeold=(target.getTime()-today.getTime());\n\r\n\rsectimeold=timeold/1000\n\rsecondsold=Math.floor(sectimeold);\n\rmsPerDay=24*60*60*1000\n\re_daysold=timeold/msPerDay\n\rdaysold=Math.floor(e_daysold);\n\re_hrsold=(e_daysold-daysold)*24;\n\rhrsold=Math.floor(e_hrsold);\n\re_minsold=(e_hrsold-hrsold)*60;\n\rminsold=Math.floor((e_hrsold-hrsold)*60);\n\rseconds=Math.floor((e_minsold-minsold)*60);\n\r\n\r  if (daysold<0) {\n\r        document.getElementById(\"TimeCounter\").innerHTML=\"逾期,倒计时已经失效\";\n\r}\n\relse{\n\rif (daysold<10) {daysold=\"0\"+daysold}\n\rif (daysold<100) {daysold=\"0\"+daysold}\n\rif (hrsold<10) {hrsold=\"0\"+hrsold}\n\rif (minsold<10) {minsold=\"0\"+minsold}\n\rif (seconds<10) {seconds=\"0\"+seconds}\n\rif (daysold<30) {\n\r        document.getElementById(\"TimeCounter\").innerHTML=daysold+\"天\";\n\r}\n\relse\n\r        document.getElementById(\"TimeCounter\").innerHTML=daysold+\"天\";\n\r}\n\r}\n\rshow_date_time();\n\r//-->\n\r                </SCRIPT>\n\r                      </div></TD>\n\r                    </TR>\n\r                  </TBODY>\n\r               </TABLE></TD>\n\r             </TR>\n\r  </TBODY></TABLE>\n\r</DIV>\n\r<SCRIPT id=clientEventHandlersJS language=JScript>\n\r<!--\n\rfunction ad_check() {\n\rself.onError=null; \n\r\n\rself.onError=null; \n\rsetTimeout(\"ad_check()\",100);\n\r}\n\r\n\rfunction Min_onclick() {\n\r//alert(ad1.style.visibility )\n\rad1.style.visibility=&#39;hidden&#39;;\n\r\n\r}\n\rfunction Max_onclick() {\n\r//alert(ad1.style.visibility )\n\rad1.style.visibility=&#39;visible&#39;;\n\r\n\r}\n\r//-->\n\r</SCRIPT>\n\r            <SCRIPT language=JScript>               \n\r//floater.innerHTML =\'\'\n\r//window.alert (floater.innerHTML.length<4000);\n\r\n\rself.onError=null;               \n\rcurrentX = currentY = 0;               \n\rwhichIt = null;                    \n\rlastScrollX = 0; lastScrollY = 0;               \n\rNS = (document.layers) ? 1 : 0;              \n\rIE = (document.all) ? 1: 0;               \n\r<!-- STALKER CODE -->               \n\rfunction heartBeat() {               \n\rif(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }              if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }     \n\rif(diffY != lastScrollY) {      \n\rpercent = .1 * (diffY - lastScrollY);  \n\rif(percent > 0) percent = Math.ceil(percent); \n\relse percent = Math.floor(percent); \n\rif(IE) document.all.floater.style.pixelTop += percent; \n\rif(NS) document.floater.top += percent;        \n\rlastScrollY = lastScrollY + percent;   \n\r}           \n\rif(diffX != lastScrollX) {   \n\rpercent = .1 * (diffX - lastScrollX);  \n\rif(percent > 0) percent = Math.ceil(percent);   \n\relse percent = Math.floor(percent);         \n\rif(IE) document.all.floater.style.pixelLeft += percent;    \n\rif(NS) document.floater.left += percent;   \n\rlastScrollX = lastScrollX + percent;          \n\r}             \n\r}            \n\r<!-- /STALKER CODE -->       \n\r<!-- DRAG DROP CODE -->       \n\rfunction checkFocus(x,y) {    \n\rstalkerx = document.floater.pageX;  \n\rstalkery = document.floater.pageY;            \n\rstalkerwidth = document.floater.clip.width;       \n\rstalkerheight = document.floater.clip.height;            \n\rif( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;           \n\relse return false;    \n\r}          \n\rfunction grabIt(e) {      \n\rif(IE) {              \n\rwhichIt = event.srcElement; \n\rwhile (whichIt.id.indexOf(\"floater\") == -1) {  \n\rwhichIt = whichIt.parentElement;             \n\rif (whichIt == null) { return true; }    \n\r}              \n\rwhichIt.style.pixelLeft = whichIt.offsetLeft;               \n\rwhichIt.style.pixelTop = whichIt.offsetTop;             \n\rcurrentX = (event.clientX + document.body.scrollLeft);           \n\rcurrentY = (event.clientY + document.body.scrollTop);            \n\r} else {              \n\rwindow.captureEvents(Event.MOUSEMOVE);  \n\rif(checkFocus (e.pageX,e.pageY)) {              \n\rwhichIt = document.floater;               \n\rstalkerTouchedX = e.pageX-document.floater.pageX;   \n\rStalkerTouchedY = e.pageY-document.floater.pageY;     \n\r}               \n\r}              \n\rreturn true;            \n\r}              \n\rfunction moveIt(e) {       \n\rif (whichIt == null) { return false; }   \n\rif(IE) {              \n\rnewX = (event.clientX + document.body.scrollLeft);             \n\rnewY = (event.clientY + document.body.scrollTop);        \n\rdistanceX = (newX - currentX);  distanceY = (newY - currentY); \n\rcurrentX = newX;  currentY = newY;           \n\rwhichIt.style.pixelLeft += distanceX;             \n\rwhichIt.style.pixelTop += distanceY;           \n\rif(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;  if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft; if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;\n\rif(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5; \n\revent.returnValue = false; \n\r} else { \n\r\n\rwhichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY); \n\rif(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset; \n\rif(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset; \n\rif( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17; \n\rif( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17; \n\rreturn false;} \n\rreturn false; \n\r} \n\rfunction dropIt() {  \n\rwhichIt = null;  \n\rif(NS) window.releaseEvents (Event.MOUSEMOVE); \n\rreturn true;      \n\r}          \n\r<!-- DRAG DROP CODE --> \n\rif(NS) {  \n\rwindow.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);\n\rwindow.onmousedown = grabIt;\n\rwindow.onmousemove = moveIt; \n\rwindow.onmouseup = dropIt; \n\r}       \n\rif(IE) {          \n\rdocument.onmousedown = grabIt;  \n\rdocument.onmousemove = moveIt; \n\rdocument.onmouseup = dropIt;     \n\r}            \n\rif(NS || IE) action = window.setInterval(\"heartBeat()\",1); \n\rsetTimeout(\"ad_check()\",10)\n\r</SCRIPT>\n\r\n\r<!-倒计时代码结束-!>";
objAD.LinkUrl        = "";
objAD.LinkTarget     = 1;
objAD.LinkAlt        = "";
objAD.Priority       = 1;
objAD.CountView      = 1;
objAD.CountClick     = 0;
objAD.ADDIR          = "zbgqt_AD";
ZoneAD_4.AddAD(objAD);

ZoneAD_4.Show();
