function ObjectAD() {
  this.ADID		  = 0;
  this.ADType	  = 0;
  this.ADName	  = "";
  this.ADSrcUrl	  = ""; 
  this.ADContent = "";
  this.CountClick = 0;
  this.InstallDir	  = "";
  this.ADDIR	 	  = "";
}

function BannerZoneAD(_id) {
  this.adNum       = 0;
  this.adDelay     = 6000;

  this.ID          = _id;
  this.ZoneID      = 0;
  this.ZoneName    = "";
  this.ZoneWidth   = 0;
  this.ZoneHeight  = 0;
  this.DivName     = "";
  this.Div         = null;

  this.AllAD       = new Array();
  this.ShowAD      = null;

  this.AddAD       = BannerZoneAD_AddAD;
  this.GetShowAD   = BannerZoneAD_GetShowAD;
  this.Show        = BannerZoneAD_Show;
}

function BannerZoneAD_AddAD(_AD) {
  this.AllAD[this.AllAD.length] = _AD;
}

function BannerZoneAD_GetShowAD() {
  this.ShowAD = this.AllAD[0];
  return;
}

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.ADDIR=="") this.ShowAD.ADDIR = "AD";
  document.write(AD_Content(this.ShowAD));
}

function AD_Content(o) {
  var str = "";
  var AD = eval('('+o.ADContent+')');
  if (o.ADType == "image" || o.ADType == "flash") {
  	var SrcUrl = o.ADSrcUrl
    if (o.InstallDir.indexOf("http://") != - 1) SrcUrl = o.InstallDir.substr(0, o.InstallDir.length - 1) + SrcUrl;
    if (SrcUrl.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='" + AD.flashWidth + "'";
      str += " height='" + AD.flashHeight + "'";
      if (o.style) str += " style='" + o.style + "'";
      if (o.extfunc) str += " " + o.extfunc + " ";
      str += ">";
      str += "<param name='movie' value='" + SrcUrl + "'>";
      if (AD.flashIsTranparent == 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='" + AD.flashWidth + "'";
      str += " height='" + AD.flashHeight + "'";
      if (o.style) str += " style='" + o.style + "'";
      if (o.extfunc) str += " " + o.extfunc + " ";
      str += " src='" + SrcUrl + "'";
      if (AD.flashIsTranparent == 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 (SrcUrl.indexOf(".gif") !=  - 1 || SrcUrl.indexOf(".jpg") !=  - 1 || SrcUrl.indexOf(".jpeg") !=  - 1 || SrcUrl.indexOf(".bmp") !=  - 1 || SrcUrl.indexOf(".png") !=  - 1) {
      if(AD.imgADLinkUrl) {
        if (o.CountClick) AD.imgADLinkUrl = o.InstallDir + o.ADDIR + "/ADCount.jsp?Action=Click&ID=" + o.ADID + "&LinkUrl=" + AD.imgADLinkUrl
        str += "<a href='" + AD.imgADLinkUrl + "' target='" + ((AD.ImgLinkTarget == 0) ? "_self" : "_blank") + "' title='" + AD.imgADLinkAlt + "'>";
      }
      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='" + SrcUrl + "'";
      if (AD.imgADWidth) str += " width='" + AD.imgADWidth + "'";
      if (AD.imgADHeight) str += " height='" + AD.imgADHeight+ "'";
      str += " border='0'>";
      if (AD.imgADLinkUrl) str += "</a>";
    }else{
    	str += "广告 "+o.ADName+" 没有内容，请添加！";
    }
  }else if (o.ADType == "text") {
  	  var display = new Number(AD.MaxDisPlay);
  	  var count = new Number(AD.count);
  	  if(display < count){
		AD.count = AD.MaxDisPlay;
	  }
	  for(var i=0;i<AD.count;i++){
	  	if(AD.text[i].textContent==""){
	  		AD.text[i].textContent="广告 "+o.ADName+" 中有未添加内容项，请添加！";
	  	}
	  	var pic = AD.text[i].adpic;
	  	str += "<li><a href="+AD.text[i].textLinkUrl+" style='color:"+AD.text[i].TextColor+";' target='_blank'>"+AD.text[i].textContent+"</a>";
	  	if(pic == "hot"){
	  		str += "<img src='/Images/hotad.gif' width='21' height='11'>";
	  	}else if(pic == "new"){
	  		str += "<img src='/Images/newad.gif' width='28' height='11'>";
	  	}
	  	str += "</li>";
	  }
  }else if (o.ADType == "code"){
  	if(AD.codeContent==""){
  		AD.codeContent="广告 "+o.ADName+" 没有内容，请添加！";
  	}
  	str = AD.codeContent;
  }else if (o.ADType == "page") {
  	if(AD.pageURL==""){
  		AD.pageURL = "广告 "+o.ADName+" 没有内容，请添加！";
  	}
    str = "<iframe id='" + "AD_" + o.ADID + "' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no width=100% height=100% src='" + AD.pageURL + "'>wait</iframe>";
  }
  return str;
}
var ZoneAD_302 = new BannerZoneAD("ZoneAD_302"); 
ZoneAD_302.ZoneID = '302'; 
ZoneAD_302.ZoneWidth = 739; 
ZoneAD_302.ZoneHeight = 73; 
 
var objAD = new ObjectAD(); 
objAD.ADID = 7; 
objAD.ADType = "image"; 
objAD.ADName = "新年快乐"; 
objAD.ADSrcUrl = "/search/wwwroot/zjdht/upload/Image/mrtp/2504356406.jpg"; 
objAD.ADContent = "{'ImageID':'250435','imgADLinkUrl':'http://','imgADWidth':'739','imgADHeight':'73','imgADLinkAlt':'','ImgLinkTarget':''}"; 
objAD.CountClick = 0; 
objAD.InstallDir = "/"; 
objAD.ADDIR = "Platform/Upload/ad"; 
ZoneAD_302.AddAD(objAD); 
 
ZoneAD_302.Show(); 

