﻿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       = "";
  this.OverdueDate = "";
}

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) {
  var date = new Date();
  var getdate = date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate();
  var today = new Date(getdate);
  var overdueDate = new Date(_AD.OverdueDate);
  if(today <= overdueDate)
  {
    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_7=new CodeZoneAD("ZoneAD_7");var objAD = new ObjectAD();
objAD.ADID= 7;objAD.ADType= 4;objAD.ADName= "工艺美术文字广告";objAD.ImgUrl= "";objAD.ImgWidth       = 0;objAD.ImgHeight      = 0;objAD.FlashWmode     = 0;objAD.ADIntro ="<div id=\"rollAD\">\r\n  <div id=\"rollText\">\r\n    <a href=\"http://www.wsxinglong.com/sjdl_12.asp\" target=\"_blank\">伍氏兴隆明清家具艺术馆</a>\r\n	<a href=\"http://www.52shehua.com/\" target=\"_blank\">您的高贵源自奢华翡翠玉器</a>\r\n	<A href=\"http://www.jcbgf.com/\" target=\"_blank\">京城百工坊</A>\r\n	<A href=\"http://www.cloisonne.com.cn/\" target=\"_blank\">京景景泰蓝</A>\r\n	<A href=\"http://www.wfgdjj.com/\" target=\"_blank\">五福古典家具</A>\r\n	<A href=\"http://www.liujunfan.com\" target=\"_blank\">桃花坞漆器</A><br />\r\n    <A href=\"http://www.nirenzhangwr.com\" target=\"_blank\">天津泥人张</A>\r\n	<A href=\"http://www.tiangongarts.com/\" target=\"_blank\">天工传世坊</A>\r\n	<A href=\"http://www.gongmeigroup.com.cn/\" target=\"_blank\">北京工美集团</A>\r\n	<A href=\"http://www.caqtq.com/qtq/main.asp\" target=\"_blank\">长安青铜器</A>\r\n	<A href=\"http://www.hualiju.com/\" target=\"_blank\">北京花梨居古典家具</A>\r\n	<A href=\"http://www.bjjingtailan.com/\" target=\"_blank\">北京兴采利华</A>\r\n	<A href=\"http://www.cnszmd.com/\" target=\"_blank\">泰州世泽木雕</A><br />\r\n  </div>\r\n</div>\r\n<script type=\"text/javascript\">\r\n// <![CDATA[\r\nvar textDiv = document.getElementById(\"rollText\");\r\nvar textList = textDiv.getElementsByTagName(\"a\");\r\nif(textList.length > 2){\r\n var textDat = textDiv.innerHTML;\r\n var br = textDat.toLowerCase().indexOf(\"<br\",textDat.toLowerCase().indexOf(\"<br\")+3);\r\n //var textUp2 = textDat.substr(0,br);\r\n textDiv.innerHTML = textDat+textDat+textDat.substr(0,br);\r\n textDiv.style.cssText = \"position:absolute; top:0\";\r\n var textDatH = textDiv.offsetHeight;MaxRoll();\r\n}\r\nvar minTime,maxTime,divTop,newTop=0;\r\nfunction MinRoll(){\r\n newTop++;\r\n if(newTop<=divTop+20){\r\n  textDiv.style.top = \"-\" + newTop + \"px\";\r\n }else{\r\n  clearInterval(minTime);\r\n  maxTime = setTimeout(MaxRoll,5000);\r\n }\r\n}\r\nfunction MaxRoll(){\r\n divTop = Math.abs(parseInt(textDiv.style.top));\r\n if(divTop>=0  &&  divTop<textDatH-20){\r\n  minTime = setInterval(MinRoll,1);\r\n }else{\r\n  textDiv.style.top = 0;divTop = 0;newTop=0;MaxRoll();\r\n }\r\n}\r\n// ]]>\r\n</script>";objAD.LinkUrl        = "";objAD.LinkTarget     = 0;objAD.LinkAlt        = "";objAD.Priority       = 1;objAD.CountView      = false;objAD.CountClick     = false;objAD.OverdueDate    = "2010/10/09";objAD.InstallDir     = "/";objAD.ADDIR= "IAA";ZoneAD_7.AddAD(objAD);ZoneAD_7.ZoneID=7;ZoneAD_7.ZoneWidth=468;ZoneAD_7.ZoneHeight=60;ZoneAD_7.ShowType=1;ZoneAD_7.Show();