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_18 = new CodeZoneAD("ZoneAD_18");
ZoneAD_18.ZoneID      = 18;
ZoneAD_18.ZoneWidth   = 0;
ZoneAD_18.ZoneHeight  = 0;
ZoneAD_18.ShowType    = 1;

var objAD = new ObjectAD();
objAD.ADID           = 20;
objAD.ADType         = 4;
objAD.ADName         = "文字广告";
objAD.ImgUrl         = "";
objAD.InstallDir     = "/";
objAD.ImgWidth       = 0;
objAD.ImgHeight      = 0;
objAD.FlashWmode     = 0;
objAD.ADIntro        = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\r<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\r<head>\n\r<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\n\r<title>文字</title>\n\r<style type=\"text/css\">\n\r.ad_navtext{\n\r	margin:0px 0px 0px;\n\r	border:1px solid #000000;\n\r	line-height:150%;\n\r	clear:both;\n\r	height:1%;\n\r	overflow:hidden;\n\r	padding-left:10px;\n\r	font-size:12px;\n\r}\n\r.ad_navtext li{\n\r	float:left;\n\r	display:block;\n\r	width:250px;\n\r	\n\r}\n\r.ad_navtext li a{\n\r	color:#000000; text-decoration:none;\n\r}\n\ra.red:link{\n\r     color:#ff0000;text-decoration:none;\n\r}\n\ra.red:visited{\n\r     color:#ff0000;text-decoration:none;\n\r}\n\ra.red:hover{\n\r     color:#ff0000;text-decoration:none;\n\r}\n\rbody{\n\r	margin:0px;\n\r	padding:0px\n\r}\n\r.ad_navtext ul{\n\r	margin:0px;\n\r	padding:0px;\n\r}\n\r</style>\n\r</head>\n\r\n\r<body>\n\r<div class=ad_navtext>\n\r<UL>\n\r<LI>· <A class=red href=\"http://www.alldatasheet.cn/\" target=_blank>【中文手册网】-免费下载中文Datasheet</A></LI>\n\r<LI>· <A href=\"http://www.dykf.com/Article/XinShou/Book/76.html\" target=_blank>可免费申请的电子类杂志列表</A></LI>\n\r<LI>· <A href=\"http://www.alldatasheet.cn/\" target=_blank>中文数据手册网-免费下载中文Datasheet</A></LI>\n\r<LI>· <A href=\"http://www.dykf.com/Dy/Ad.asp\" target=_blank>全站此处文字广告招租,QQ:225542875</A></LI>\n\r<LI>· <A class=red title=电源书：开关电源入门 href=\"http://www.amazon.cn/mn/searchApp?source=dyfan&searchType=1&keywords= 开关电源入门\">电源书：开关电源入门</A></LI>\n\r<LI>· <A title=卓越亚马逊，电源专业书籍七折起 href=\"http://www.amazon.cn/search/search.asp?source=dyfan&searchType=1&searchWord=%B5%E7%D4%B4\" target=_blank>卓越亚马逊，电源专业书籍七折起</A></LI>\n\r<LI>· <A class=red title=开关电源设计(第2版) href=\"http://www.amazon.cn/mn/searchApp?source=dyfan&searchType=1&keywords=开关电源设计\">电源书：开关电源设计(第2版)</A></LI>\n\r<LI>· <A class=red title=书：精通开关电源设计 href=\"http://www.amazon.cn/mn/searchApp?source=dyfan&searchType=1&keywords=精通开关电源设计\">电源书：精通开关电源设计</A></LI>\n\r<LI>· PowerEsim--免费在线开关电源设计工具</LI>\n\r<LI>· <A href=\"http://www.dykf.com/Dy/Ad.asp\" target=_blank>全站此处文字广告招租,QQ:225542875</A></LI>\n\r<LI>· <A href=\"Dy/Ad.asp\" target=_blank>全站此处文字广告招租,QQ:225542875</A></LI>\n\r<LI>· <A class=red href=\"http://www.dykf.com/Soft/Book/Power/101.html\" target=_blank>电源电路大全，免费下载</A></LI>\n\r<LI>· <A href=\"http://www.dykf.com/Dy/Ad.asp\" target=_blank>全站此处文字广告招租,QQ:225542875</A></LI>\n\r<LI>· <A href=\"http://www.dykf.com/Dy/Ad.asp\" target=_blank>全站此处文字广告招租,QQ:225542875</A></LI>\n\r<LI>· <A href=\"http://www.dykf.com/Dy/Ad.asp\" target=_blank>全站此处文字广告招租,QQ:225542875</A></LI></UL></div>\n\r</body>\n\r</html>";
objAD.LinkUrl        = "";
objAD.LinkTarget     = 1;
objAD.LinkAlt        = "";
objAD.Priority       = 1;
objAD.CountView      = 0;
objAD.CountClick     = 0;
objAD.ADDIR          = "AD";
ZoneAD_18.AddAD(objAD);

ZoneAD_18.Show();
