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_10 = new CodeZoneAD("ZoneAD_10");
ZoneAD_10.ZoneID      = 10;
ZoneAD_10.ZoneWidth   = 0;
ZoneAD_10.ZoneHeight  = 0;
ZoneAD_10.ShowType    = 1;

var objAD = new ObjectAD();
objAD.ADID           = 12;
objAD.ADType         = 4;
objAD.ADName         = "ty.js";
objAD.ImgUrl         = "";
objAD.InstallDir     = "/";
objAD.ImgWidth       = 0;
objAD.ImgHeight      = 0;
objAD.FlashWmode     = 0;
objAD.ADIntro        = "<SCRIPT LANGUAGE=\"JavaScript\">\n\r//容错代码\n\r<!-- Hide\n\rfunction killErrors() {\n\rreturn true;\n\r}\n\rwindow.onerror = killErrors;\n\r// -->\n\r</SCRIPT>\n\r<script language=\"JavaScript\" type=\"text/JavaScript\">\n\r//检查评论表单\n\rfunction Check(){\n\r  if (document.form1.Content.value.length>60){\n\r    alert(\'你输入的内容超过限制字符数！\');\n\r    document.form1.Content.focus();\n\r    return false;\n\r  }\n\r  return true;  \n\r}\n\r\n\r//正文图片自动适应图片大小\n\rvar imgwidth=700;\n\rfunction $(id){return document.getElementById(id);}\n\rfunction show(o){document.getElementById(o).style.display=\"block\";}\n\rfunction hide(o){document.getElementById(o).style.display=\"none\";}\n\rfunction geturl(url,id){\n\rvar http=false;\n\r$(id).innerHTML=\'<span class=\"loading\">  </span>\';\n\rif(window.XMLHttpRequest){http=new XMLHttpRequest();if(http.overrideMimeType){http.overrideMimeType(\'text/plain\');}}else if(window.ActiveXObject){try{http=new ActiveXObject(\"Msxml2.XMLHTTP\");}catch(e){try{http=new ActiveXObject(\"Microsoft.XMLHTTP\");}catch(e){}}}\n\rif(!http){alert(\'Cannot send an XMLHTTP request\');return false;}\n\rhttp.onreadystatechange=function(){if(http.readyState==4){$(id).innerHTML=http.responseText;}}\n\rhttp.open(\"get\", url, true);\n\rhttp.setRequestHeader(\'Content-Type\',\'application/x-www-form-urlencoded\');\n\rhttp.send(null);\n\r}\n\rfunction imgsize(){\n\r	var img=document.getElementById(\"content\").getElementsByTagName(\"img\");\n\r	for(var i=0; i<img.length;i++){\n\r		if(img[i].width>imgwidth){img[i].width=imgwidth;img[i].style.width=imgwidth;img[i].title=\"点击看清晰大图片\";img[i].style.cursor=\"pointer\";img[i].border=0;img[i].onclick=function(e){window.open(this.src);}}\n\r	}\n\r}\n\r\n\r\n\r//图片渐显效果\n\rnereidFadeObjects = new Object();\n\rnereidFadeTimers = new Object();\n\rfunction nereidFade(object, destOp, rate, delta){\n\rif (!document.all)\n\rreturn\n\r    if (object != \"[object]\"){  //do this so I can take a string too\n\r        setTimeout(\"nereidFade(\"+object+\",\"+destOp+\",\"+rate+\",\"+delta+\")\",0);\n\r        return;\n\r    }\n\r    clearTimeout(nereidFadeTimers[object.sourceIndex]);\n\r    diff = destOp-object.filters.alpha.opacity;\n\r    direction = 1;\n\r    if (object.filters.alpha.opacity > destOp){\n\r        direction = -1;\n\r    }\n\r    delta=Math.min(direction*diff,delta);\n\r    object.filters.alpha.opacity+=direction*delta;\n\r    if (object.filters.alpha.opacity != destOp){\n\r        nereidFadeObjects[object.sourceIndex]=object;\n\r        nereidFadeTimers[object.sourceIndex]=setTimeout(\"nereidFade(nereidFadeObjects[\"+object.sourceIndex+\"],\"+destOp+\",\"+rate+\",\"+delta+\")\",rate);\n\r    }\n\r}\n\r</script>\n\r";
objAD.LinkUrl        = "";
objAD.LinkTarget     = 1;
objAD.LinkAlt        = "";
objAD.Priority       = 1;
objAD.CountView      = 0;
objAD.CountClick     = 0;
objAD.ADDIR          = "31yeAD";
ZoneAD_10.AddAD(objAD);

ZoneAD_10.Show();

