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 BannerZoneAD(_id) {
  /* Define Constants */
  this.adNum       = 0;
  this.adDelay     = 6000;

  /* 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*/

  /* Define Objects */
  this.AllAD       = new Array();
  this.ShowAD      = null;

  /* Define Functions */
  this.AddAD       = BannerZoneAD_AddAD;
  this.GetShowAD   = BannerZoneAD_GetShowAD;
  this.Show        = BannerZoneAD_Show;
  this.LoopShow    = BannerZoneAD_LoopShow;

}

function BannerZoneAD_AddAD(_AD) {
  this.AllAD[this.AllAD.length] = _AD;
}

function BannerZoneAD_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 BannerZoneAD_Show() {
  if (!this.AllAD) {
    return;
  } else {
    this.GetShowAD();
  }

  if (this.ShowAD == null) return false;
  this.DivName = "BannerZoneAD_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"
  if (this.ShowType == 3) {
    document.write("<div id='" + this.DivName + "' style='visibility:visible; z-index:1; width:" + this.ZoneWidth + "; height:" + this.ZoneHeight + "; filter: revealTrans(duration=2,transition=20);'>" + AD_Content(this.ShowAD) + "</div>");
  } else {
    if (navigator.appName == "Netscape") {
      document.write("<layer id='" + this.DivName + "' width='" + this.ZoneWidth + "px' height='" + this.ZoneHeight + "px'>" + AD_Content(this.ShowAD) + "</layer>");
    } else {
      document.write("<div id='" + this.DivName + "' style='visibility:visible; z-index:1; width:" + this.ZoneWidth + "px; height:" + this.ZoneHeight + "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);
  if (this.ShowType == 3) this.LoopShow();
}

function BannerZoneAD_LoopShow() {
  if(this.adNum<this.AllAD.length-1) this.adNum++ ; 
  else this.adNum=0; 
  this.Div.filters.revealTrans.Transition=Math.floor(Math.random()*23); 
  this.Div.filters.revealTrans.apply(); 
  if (this.AllAD[this.adNum].ImgWidth) this.AllAD[this.adNum].ImgWidth = this.ZoneWidth
  if (this.AllAD[this.adNum].ImgHeight) this.AllAD[this.adNum].ImgHeight = this.ZoneHeight
  this.Div.innerHTML=AD_Content(this.AllAD[this.adNum]);
  this.Div.filters.revealTrans.play() 
  this.Div.timer=setTimeout(this.ID+".LoopShow()",this.adDelay);
}

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 + "'";
      str += " height='" + o.ImgHeight + "'";
      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 + "'";
      str += " height='" + o.ImgHeight + "'";
      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 + "'";
      if (o.ImgHeight) str += " height='" + o.ImgHeight + "'";
      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_1 = new BannerZoneAD("ZoneAD_1");
ZoneAD_1.ZoneID      = 1;
ZoneAD_1.ZoneWidth   = 325;
ZoneAD_1.ZoneHeight  = 250;
ZoneAD_1.ShowType    = 1;

var objAD = new ObjectAD();
objAD.ADID           = 74;
objAD.ADType         = 4;
objAD.ADName         = "康美福专题广告——325*220——代码";
objAD.ImgUrl         = "";
objAD.ImgWidth       = 0;
objAD.ImgHeight      = 0;
objAD.FlashWmode     = 0;
objAD.ADIntro        = "<style type=\"text/css\">\n\rimg{border:0px}\n\r.lanrentuku{width:325px;height:60px}\n\r#page_left_1 {WIDTH: 325px; }\n\r#page_left_2 {WIDTH: 325px}\n\r#page_left_2_1 {FONT-WEIGHT: normal; FLOAT: right; BACKGROUND-IMAGE: url(http://www.51ttyy.com/ad2006/UploadADPic/201003/2010032917222632.jpg); WIDTH: 74px; COLOR: #000000; MARGIN-RIGHT: 2px; TEXT-ALIGN: center}\n\r#page_left_2_1_1 {FONT-WEIGHT: normal; WIDTH: 100%; CURSOR: hand; PADDING-TOP: 5px; TEXT-ALIGN: center}\n\r#page_left_2_1_2 {FONT-WEIGHT: normal; WIDTH: 74px; COLOR: #ffffff; PADDING-TOP: 5px; TEXT-ALIGN: center}\n\r#page_left_2_2 {FONT-WEIGHT: normal; FLOAT: right; BACKGROUND-IMAGE: url(p_12_04.jpg); WIDTH: 74px; COLOR: #ffffff; MARGIN-RIGHT: 2px; TEXT-ALIGN: center}\n\r.sty20 {FONT-WEIGHT: normal; FONT-SIZE: 12px; FLOAT: right; BACKGROUND-IMAGE: url(http://www.51ttyy.com/ad2006/UploadADPic/201003/2010032917222632.jpg); WIDTH: 74px; COLOR: #000000; LINE-HEIGHT: 20px; MARGIN-RIGHT: 2px; FONT-FAMILY: \"宋体\"; TEXT-ALIGN: center}\n\r.sty21 {FONT-WEIGHT: normal; FONT-SIZE: 12px; FLOAT: right; BACKGROUND-IMAGE: url(http://www.51ttyy.com/ad2006/UploadADPic/201003/2010032917233143.jpg); WIDTH: 75px; COLOR: #ffffff; LINE-HEIGHT: 20px; MARGIN-RIGHT: 2px; FONT-FAMILY: \"宋体\"; TEXT-ALIGN: center}\n\r.sty21 #page_left_2_1_1 {BACKGROUND-POSITION: center top; BACKGROUND-IMAGE: url(http://www.51ttyy.com/ad2006/UploadADPic/201003/2010032917230747.gif); BACKGROUND-REPEAT: no-repeat}\n\r</style>\n\r<SCRIPT language=javascript>\n\r<!--\n\rvar imgUrl=new Array();\n\rvar imgLink=new Array();\n\rvar label = new Array(); \n\r\n\rimgUrl[1]=\"http://www.2466.cn/ad2006/UploadADPic/201007/2010072814571986.jpg\";\n\rimgLink[1]=\"http://www.8155.com/shop/eat/cooking/201007/2341.shtml\";\n\rlabel[1] = \"维他美仕\";\n\r\n\rimgUrl[2]=\"http://www.2466.cn/ad2006/UploadADPic/201007/2010072111012820.jpg\";\n\rimgLink[2]=\"http://www.8155.com/\";\n\rlabel[2] = \"无忧购物\";\n\r\n\rimgUrl[3]=\"http://www.mxabc.com/AD2006/UploadADPic/201007/2010071611120614.jpg\";\n\rimgLink[3]=\"http://www.8155.com/shop/taocan/229.html\";\n\rlabel[3] = \"壮阳\";\n\r\n\rlabel[4] = \"自选套装\";\n\r\n\rimgUrl[4]=\"http://www.2466.cn/ad2006/UploadADPic/201007/2010070815291848.jpg\";\n\rimgLink[4]=\"http://www.8155.com/shop/taocan/215.html\";\n\rlabel[4] = \"自选套装\";\n\r\n\r\n\r          \n\r    var num_pic =4;\n\rvar label_width = 325/num_pic-2;\n\r\n\rvar focusPicNumSrc=\"www.8155.com\";\n\rvar time1 = 0; //打开页面时等待图片载入的时间，单位为秒，可以设置为0\n\rvar time2 = 4; //图片轮转的间隔时间\n\r\n\rvar timeout1 = time1*1000;\n\rvar timeout2 = time2*1000;\n\rvar jumpUrl = \'\';\n\rvar nn=1;//初始焦点\n\rvar curFileNum = 1;//传递给myPlayer对象 表示目前焦点序列值\n\r\n\rdocument.write(\'<style>\');\n\rdocument.write(\'.focusPic {border:1px #333333 solid; OVERFLOW: hidden;  WIDTH: 325px; POSITION: relative; HEIGHT: 220px}\');\n\rdocument.write(\'.focusPicNum {Z-INDEX: 99; right: 0px; POSITION: absolute; TOP: 190px;MARGIN: 3px}\');\n\rdocument.write(\'</style>\');\n\r\n\rif(navigator.appName == \"Microsoft Internet Explorer\"){\n\rsetTimeout(\'change_img()\',timeout1);\n\r}\n\rfunction change_img(){\n\rif(nn>num_pic) nn=1;\n\rsetTimeout(\'setFocus2(\'+nn+\')\',timeout1);\n\rnn++;\n\rtt=setTimeout(\'change_img()\',timeout2);\n\r}\n\rfunction setFocus2(i){\n\rjumpUrl=imgLink[i];\n\rcurFileNum = i;\n\rselectLayer1(i);\n\rimgInit.filters.revealTrans.Transition=23;\n\rimgInit.filters.revealTrans.apply();\n\r    playTran();\n\rdocument.images.imgInit.src=imgUrl[i];\n\r}\n\rfunction setFocus1(i){\n\rnn = i;\n\rln=i;\n\rcurFileNum = i;\n\rselectLayer1(i);\n\rsetFocus2(i);\n\r}\n\rfunction selectLayer1(i){\n\rfor (a=1;a<num_pic+1;a++ ){\n\r//document.images[\'fi_\'+a].src=focusPicNumSrc+\'/bn_focus_num_ws_0\'+a+\'off.gif\';\n\r//document.getElementById(\'label_\'+id).class=\'sty20\';\n\rvar obj = GetObj(\'label_\'+a);\n\robj.className=\'sty20\';\n\robj.style.width=label_width;\n\r}\n\r//document.images[\'fi_\'+i].src=focusPicNumSrc+\'/bn_focus_num_ws_0\'+i+\'on.gif\';\n\r//document.getElementById(\'label_\'+id).class=\'sty21\';\n\rvar obj = GetObj(\'label_\'+i);\n\robj.className=\'sty21\';\n\robj.style.width=label_width;\n\r}\n\rfunction goUrl(){\n\rln=nn;\n\rif (ln ==1)if (jumpUrl!=\'\') jumpUrl=imgLink[ln];\n\rjumpTarget=\'_blank\';\n\rif (jumpUrl != \'\'){\n\rif (jumpTarget != \'\')window.open(jumpUrl,jumpTarget);\n\relse location.href=jumpUrl;\n\r}\n\r}\n\r\n\rfunction playTran(){\n\rif (document.all)imgInit.filters.revealTrans.play();\n\r}\n\rfunction GetObj(objName){ \n\r    if(document.getElementById){ \n\r        return eval(\'document.getElementById(\"\' + objName + \'\")\'); \n\r    }else if(document.layers){ \n\r        return eval(\"document.layers[\'\" + objName +\"\']\"); \n\r    }else{ \n\r        return eval(\'document.all.\' + objName); \n\r    } \n\r} \n\r//-->\n\r</SCRIPT>\n\r\n\r<DIV class=focusPic id=focusPic>\n\r<SCRIPT language=JavaScript>\n\r<!--\n\rdocument.write(\'<DIV class=focusPicNum style=display:none>\');\n\rfor (i=1;i<num_pic+1;i++ )\n\r{\n\rdocument.write(\'<A href=javascript:setFocus1(\'+i+\');><IMG height=15 src=\'+focusPicNumSrc+\'/bn_focus_num_ws_0\'+i+\'off.gif width=23 border=0 name=fi_\'+i+\'></A>\');\n\r}\n\rdocument.write(\'</DIV>\');\n\rdocument.write(\'<div id=\"page_left_1\">\');\n\rdocument.write(\'<a id=\"PicLink\" href=\"javascript:goUrl()\"><img src=\"\'+imgUrl[1]+\'\" width=325  name=imgInit height=\"220\" border=\"0\" style=\"FILTER: revealTrans(duration=2,transition=6)\"></a>\');\n\rdocument.write(\'</div>\');\n\r\n\rdocument.images.imgInit.src=imgUrl[1];\n\r\n\r//-->\n\r</SCRIPT>\n\r</DIV>\n\r<SCRIPT language=javascript>\n\r<!--\n\rfor(i=1;i<num_pic+1;i++)\n\rdocument.write(\'<div class=\"sty20\" style=\"width:\'+label_width+\'\" id=\"label_\'+i+\'\" onMouseOver=\"setFocus1(\'+i+\')\"><div id=\"page_left_2_1_1\">\'+label[i]+\'</div></div>\');\n\r-->\n\r</SCRIPT>";
objAD.LinkUrl        = "";
objAD.LinkTarget     = 1;
objAD.LinkAlt        = "";
objAD.Priority       = 1;
objAD.CountView      = 0;
objAD.CountClick     = 0;
objAD.InstallDir     = "/";
objAD.ADDIR          = "ad2006";
ZoneAD_1.AddAD(objAD);

ZoneAD_1.Show();
