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 CodeZoneAD(_id) {
  /* Define Common Variables*/
  this.ID          = _id;
  this.ZoneID      = 0;

  /* Define Unique Variables*/

  /* Define Objects */
  this.AllAD       = new Array();
  this.ShowAD      = null;

  /* Define Functions */
  this.AddAD       = CodeZoneAD_AddAD;
  this.GetShowAD   = CodeZoneAD_GetShowAD;
  this.Show        = CodeZoneAD_Show;

}

function CodeZoneAD_AddAD(_AD) {
  this.AllAD[this.AllAD.length] = _AD;
}

function CodeZoneAD_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 CodeZoneAD_Show() {
  if (!this.AllAD) {
    return;
  } else {
    this.GetShowAD();
  }

  if (this.ShowAD == null) return false;
  document.write(this.ShowAD.ADIntro);
}

var ZoneAD_1 = new CodeZoneAD("ZoneAD_1");
ZoneAD_1.ZoneID      = 1;
ZoneAD_1.ZoneWidth   = 0;
ZoneAD_1.ZoneHeight  = 0;
ZoneAD_1.ShowType    = 1;

var objAD = new ObjectAD();
objAD.ADID           = 2;
objAD.ADType         = 4;
objAD.ADName         = "全站顶部栏目导航";
objAD.ImgUrl         = "";
objAD.ImgWidth       = 0;
objAD.ImgHeight      = 0;
objAD.FlashWmode     = 0;
objAD.ADIntro        = "<table cellSpacing=0 cellPadding=0 width=987 border=0>\n\r    <tr>\n\r      <td background=/images1/top1.gif height=23>\n\r        <table cellSpacing=0 cellPadding=0 width=\"100%\" border=0>\n\r          <tr>\n\r            <td width=\"23%\"> </td>\n\r            <td width=\"77%\">\n\r              <table cellSpacing=0 cellPadding=0 width=\"100%\" border=0>\n\r                <tr>\n\r                  <td width=\"80%\">\n\r                    <table cellSpacing=0 cellPadding=0 border=0>\n\r                      <tr>\n\r                        <td align=right width=430>\n\r<div align=center>想每天免费观看最新电影、美女图片、幽默笑话、美图图酷吗？八脚娱乐网<STRONG>→</STRONG> \n\r</div>\n\r                        </td>\n\r                        <td width=66>\n\r<div align=center><IMG height=9 src=\"/images1/top6.gif\" width=7><A style=\"CURSOR: hand\" onClick=\"var strHref=window.location.href;this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.6554.cn\');\" href=\"http://www.6554.cn/\"><FONT color=#ff0000>设为首页</FONT></A> \n\r</div>\n\r                        </td>\n\r                        <td width=66>\n\r<div align=center><IMG height=9 src=\"/images1/top6.gif\" width=7><A href=\"javascript:window.external.AddFavorite(\'http://www.6554.cn\',\'八脚娱乐网%20每天都要上喔！\');\" target=_self><FONT color=#ff0000>加入收藏</FONT></A> \n\r</div>\n\r                        </td>\n\r                      </tr>\n\r                    </table>\n\r                  </td>\n\r                  <td align=middle width=\"20%\">八脚娱乐网 每天都要上喔！</td>\n\r                </tr>\n\r              </table>\n\r            </td>\n\r          </tr>\n\r        </table>\n\r      </td>\n\r    </tr>\n\r  </table>\n\r  <table cellSpacing=0 cellPadding=0 width=987 border=0>\n\r    <tr>\n\r      <td align=middle width=220 height=55><IMG height=55 src=\"/images1/LOGO.gif\" width=220></td>\n\r      <td height=55>\n\r        <table cellSpacing=0 cellPadding=0 width=759 border=0>\n\r          <tr>\n\r            <td width=130><a href=\"/Article/\" target=_top><img height=42 src=\"/images1/L1.gif\" width=123 border=0></a></td>\n\r            <td width=130><a href=\"/vod/\"><IMG height=42 src=\"/images1/L2.gif\" width=123 border=0></a></td>\n\r            <td width=130><A href=\"/joke/\" target=_top><IMG height=42 src=\"/images1/L3.gif\" width=123 border=0></A></td>\n\r            <td width=130><A href=\"/mm/\" target=_top><IMG height=42 src=\"/images1/L4.gif\" width=123 border=0></A></td>\n\r            <td width=84><A href=\"/tv.htm\" target=_blank><IMG height=42 src=\"/images1/L5.gif\" width=75 border=0></A></td>\n\r            <td width=84><A href=\"http://www.6554.cn/mms.htm\" target=_blank><IMG height=42 src=\"/images1/L6.gif\" width=75 border=0></A></td>\n\r            <td width=75><A href=\"http://flash.6554.cn\" target=_blank><IMG height=42 src=\"/images1/L7.gif\" width=75 border=0></A></td>\n\r          </tr>\n\r        </table>\n\r      </td>\n\r    </tr>\n\r  </table>\n\r  <table cellSpacing=0 cellPadding=0 width=987 border=0>\n\r    <tr>\n\r      <td height=5><IMG height=1 src=\"/images1/0.gif\" width=1></td>\n\r    </tr>\n\r  </table>";
objAD.LinkUrl        = "";
objAD.LinkTarget     = 1;
objAD.LinkAlt        = "";
objAD.Priority       = 1;
objAD.CountView      = 0;
objAD.CountClick     = 0;
objAD.InstallDir     = "/";
objAD.ADDIR          = "AD";
ZoneAD_1.AddAD(objAD);

ZoneAD_1.Show();
