﻿// JScript 文件
 function ObjectAD() {
  this.ADID        = 0;//广告编号
  this.ADType      = 0;//广告类型 1 flash 2 图片 3 文字链接 4 文字 5框架 
  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.StartTime   = 0;
  this.EndTime     = 0;
  this.Cid         = "";
}
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) {
        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 ) {
		if (o.LinkUrl) {
			str = "<a href='" + o.LinkUrl + "' target='" + ((o.LinkTarget == 0) ? "_self" : "_blank") + "' title='" + o.LinkAlt + "'>" + o.ADIntro + "</a>";
		}else{
			str = o.ADIntro;
		}
  } else if (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.ImgUrl + "'>wait</iframe>";
  }
  return str;
}
function BannerShow(_AD)
{
	document.write(AD_Content(_AD));
}
function FlvBannerShow(_AD)
{
	return "";
}
var showad = true;
var Toppx = 60;   //上端位置
var AdDivW = 100;  //宽度
var AdDivH = 320;  //高度
var PageWidth = 820; //页面多少宽度象素下正好不出现左右滚动条
var MinScreenW = 1024; //显示广告的最小屏幕宽度象素 
function DuiLianBannerLeftShow(_AD)
{
	// JavaScript Document

	var ClosebuttonHtml = '<div align="right" style="position: absolute;top:296px;right:-4px;margin:2px;padding:2px;z-index:2000;"><table width="100" border="0" cellspacing="0" cellpadding="0" height="20" bgcolor="#CECFCE" ><tr><td style="text-align:center;"><a href="javascript:;" onclick="hidead()" style="color:#000000;  text-align:center;text-decoration:none;font-size:12px;">关闭</a></td></tr></table></div>'
	
	var AdContentHtml = AD_Content(_AD);
	
	document.write ('<div id="Javascript.LeftDiv" style="position: absolute;z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>');
	
	window.onscroll=scall;
	window.onresize=scall;
	window.onload=scall;
}
function DuiLianBannerRightShow(_AD)
{
	// JavaScript Document

	var ClosebuttonHtml = '<div align="right" style="position: absolute;top:296px;right:-4px;margin:2px;padding:2px;z-index:2000;"><table width="100" border="0" cellspacing="0" cellpadding="0" height="20" bgcolor="#CECFCE" ><tr><td style="text-align:center;"><a href="javascript:;" onclick="hidead()" style="color:#000000;  text-align:center;text-decoration:none;font-size:12px;">关闭</a></td></tr></table></div>'
	
	var AdContentHtml = AD_Content(_AD);
		document.write ('<div id="Javascript.RightDiv" style="position: absolute;z-index:1000px;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>');
	
	window.onscroll=scall;
	window.onresize=scall;
	window.onload=scall;
}
function scall(){
	 if (window.screen.width<MinScreenW){
	  alert("临时提示：\n\n显示器分辨率宽度小于"+MinScreenW+",不显示广告");
	  showad = false;
	  document.getElementById("Javascript.LeftDiv").style.display="none";
	  document.getElementById("Javascript.RightDiv").style.display="none";
	  return;
	 }
	 var Borderpx = ((window.screen.width-PageWidth)/2-AdDivW)/2;
	 if (showad)
	 {
	     document.getElementById("Javascript.LeftDiv").style.display="";
	     document.getElementById("Javascript.LeftDiv").style.top=document.body.scrollTop+Toppx;
	     document.getElementById("Javascript.LeftDiv").style.left=document.body.scrollLeft+Borderpx;
	     document.getElementById("Javascript.RightDiv").style.display="";
	     document.getElementById("Javascript.RightDiv").style.top=document.body.scrollTop+Toppx;
	     document.getElementById("Javascript.RightDiv").style.left=document.body.scrollLeft+document.body.clientWidth-document.getElementById("Javascript.RightDiv").offsetWidth-Borderpx;
    }
}
function hidead()
{
   showad = false;  
 document.getElementById("Javascript.LeftDiv").style.display="none";
 document.getElementById("Javascript.RightDiv").style.display="none";
}
