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_4 = new CodeZoneAD("ZoneAD_4");
ZoneAD_4.ZoneID      = 4;
ZoneAD_4.ZoneWidth   = 0;
ZoneAD_4.ZoneHeight  = 0;
ZoneAD_4.ShowType    = 1;

var objAD = new ObjectAD();
objAD.ADID           = 1;
objAD.ADType         = 4;
objAD.ADName         = "内页上部广告";
objAD.ImgUrl         = "";
objAD.InstallDir     = "http://www.fomen123.com/";
objAD.ImgWidth       = 0;
objAD.ImgHeight      = 0;
objAD.FlashWmode     = 0;
objAD.ADIntro        = "<table width=\"100%\" border=\"0\" align=\"center\"> \n\r  \n\r  <tr>\n\r    <td height=\"20\" align=\"left\">  ·<a href=\"http://www.fomen123.com/fo/new/bizhi/8599.html\" target=\"_blank\" ><font  size=\"2\">初学佛者指南：《快速学佛指引》</font></a></td>\n\r    <td height=\"20\" align=\"left\">·<a href=\"http://www.shixiu.org/\" target=\"_blank\" ><font size=\"2\" color=red>实修论坛——精进学佛者的一方净土！</font></a></td>\n\r  </tr>\n\r  <tr>\n\r    <td height=\"20\" align=\"left\"><a href=\"http://www.fomen123.com/fo/jingdian/xyjl/6783.html\" target=\"_blank\" ><font size=\"2\">·为何法布施胜财布施</font></a> <a href=\"http://www.fomen123.com/fo/dyjh/dyjh/8743.html\" target=\"_blank\"  ><font size=\"2\" >精进提早得福报</font></a></td>\n\r    <td align=\"left\"><a href=\"http://www.fomen123.com/fo/fojiao/\" target=\"_blank\" ><font size=\"2\">·佛教告诉我们宇宙真相</font></a> <a href=\"http://www.fomen123.com/fo/jingdian/fslzbj/Index.html\" target=\"_blank\" ><font size=\"2\" >佛法治病案例有诚则灵</font></a></td>\n\r  </tr>\n\r  <tr>\n\r    <td align=\"left\" height=\"20\"><a href=\"http://www.fomen123.com/dzj/\" target=\"_blank\" ><font size=\"2\" color=red>·在线阅读大藏经</font></a> <a href=\"http://www.fomen123.com/fo/jingdian/xyjl/6753.html\" target=\"_blank\" ><font size=\"2\">不应食肉的佛经汇集</font></a></td>\n\r    <td align=\"left\"><a href=\"http://www.fomen123.com/fo/nianfo/fohao/9930.html\" target=\"_blank\" ><font size=\"2\" >·印光大师&宣化上人：紧急关头多念南无观音菩萨</font></a></td>\n\r  </tr> \n\r</table>\n\r<!-- 注意下面不能更长了，要在IE6，firefox等测试才行，否则会掉到页面下面-->\n\r<table width=\"100%\" border=\"0\" align=\"center\">\n\r  <tr>\n\r    <td align=\"center\">\n\r	<input type=\"button\" value=\"一经于耳、恶业悉灭，灭罪之王“佛顶尊胜陀罗尼”（精彩分享）\" onClick=\"window.open(\'http://www.shixiu.org/thread-7229-1-1.html\')\">\n\r</td>  </tr>\n\r\n\r</table>\n\r";
objAD.LinkUrl        = "";
objAD.LinkTarget     = 1;
objAD.LinkAlt        = "";
objAD.Priority       = 1;
objAD.CountView      = 0;
objAD.CountClick     = 0;
objAD.ADDIR          = "AD2006";
ZoneAD_4.AddAD(objAD);

ZoneAD_4.Show();

