
// AD Banner object
function ADBanner(){
  this.htmlcode  = "";// Non image banner's html code
  this.href      = "";// Link's href attrib
  this.imgsrc    = "";// Image's src attrib
  this.imgwidth  = "";// Image's width attrib
  this.imgheight = "";// Image's height attrib
  this.imgalt    = "";// Image's alt attrib
  this.imgborder = "";// Image's border attrib
  this.weight    = 1;// Banner's show weight
  this.place     = 1// Banner's place
  this.type      = 1;// Banner's type
  this.id      = 0;// Banner's ID
}

// Make Banner objects array
function CreatBanners(aBanners, aNum){
  for( var i=0; i<aNum; i++ ){
    aBanners[i] = new ADBanner();
  }
}

// Show banner
function showbanner(aPlace, aType, aBannerID)
{
  var amount = ADBanners.length;
  var includeList = new Array(amount);

  if (!document.usedBanners){
    document.usedBanners = new Array(amount);
for (var i=0; i<amount; i++)
      document.usedBanners[i] = -1;
  }
 
  var usedList = document.usedBanners;

  if (arguments.length == 2){
    var j = 0;
    var sum = 0;
for(var i=0; i<amount; i++){
if (ADBanners[i].place == aPlace && ADBanners[i].type == aType){
if (usedList[i] != i){
  includeList[j] = i;
      j++;
          sum = sum + ADBanners[i].weight;
    }
  }
 }
    if (sum <= 0)
  return;
    var rndNum = Math.round(Math.random() * sum);

    i = 0;
    j = 0;
    while (true) {
      j = j + ADBanners[includeList[i]].weight;
      if (j >= rndNum)
        break;
      i++;
    }

    i = includeList[i];
  }
  else{
if (aBannerID >= 0 && aBannerID < amount)
      i = aBannerID;
else
  return;
  }

  usedList[i] = i;

  if (ADBanners[i].htmlcode == "")
    document.write('<A HREF="'+ ADBanners[i].href +'" target=_blank><IMG SRC="'+ ADBanners[i].imgsrc +'" WIDTH="'+ ADBanners[i].imgwidth +'" HEIGHT="'+ ADBanners[i].imgheight +'" ALT="'+ ADBanners[i].imgalt +'" BORDER="'+ ADBanners[i].imgborder +'"></A>');
  else
    document.write(ADBanners[i].htmlcode);
  document.write('<script src=/common/jsbanner/redirect.asp?action=visit&id='+ADBanners[i].id+' ></s'+'cript>')
}

var ADBanners = new Array();

CreatBanners(ADBanners, 9);

ADBanners[0].htmlcode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="738" height="296"><param name=movie value="http://www.ymmm.com.cn/images/index.swf"><param name=wmode value=transparent><param name=quality value=high><embed src="http://www.ymmm.com.cn/images/index.swf" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="738" height="296"></embed></object>';
ADBanners[0].weight    = 10;
ADBanners[0].place= 2;
ADBanners[0].type = 2;
ADBanners[0].id = 38;

ADBanners[1].htmlcode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="738" height="296"><param name=movie value="http://www.ymmm.com.cn/images/jddt.swf"><param name=wmode value=transparent><param name=quality value=high><embed src="http://www.ymmm.com.cn/images/jddt.swf" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="738" height="296"></embed></object>';
ADBanners[1].weight    = 10;
ADBanners[1].place= 3;
ADBanners[1].type = 3;
ADBanners[1].id = 39;

ADBanners[2].htmlcode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="738" height="296"><param name=movie value="http://www.ymmm.com.cn/images/jdjjtop.swf"><param name=wmode value=transparent><param name=quality value=high><embed src="http://www.ymmm.com.cn/images/jdjjtop.swf" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="738" height="296"></embed></object>';
ADBanners[2].weight    = 10;
ADBanners[2].place= 4;
ADBanners[2].type = 4;
ADBanners[2].id = 40;

ADBanners[3].htmlcode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="242" height="378"><param name=movie value="http://www.ymmm.com.cn/images/logo.swf"><param name=wmode value=transparent><param name=quality value=high><embed src="http://www.ymmm.com.cn/images/logo.swf" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="242" height="378"></embed></object>';
ADBanners[3].weight    = 10;
ADBanners[3].place= 5;
ADBanners[3].type = 5;
ADBanners[3].id = 41;

ADBanners[4].htmlcode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="738" height="190"><param name=movie value="http://www.ymmm.com.cn/images/srhl.swf"><param name=wmode value=transparent><param name=quality value=high><embed src="http://www.ymmm.com.cn/images/srhl.swf" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="738" height="190"></embed></object>';
ADBanners[4].weight    = 10;
ADBanners[4].place= 6;
ADBanners[4].type = 6;
ADBanners[4].id = 42;

ADBanners[5].htmlcode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="242" height="290"><param name=movie value="http://www.ymmm.com.cn/images/srhllogo.swf"><param name=wmode value=transparent><param name=quality value=high><embed src="http://www.ymmm.com.cn/images/srhllogo.swf" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="242" height="290"></embed></object>';
ADBanners[5].weight    = 10;
ADBanners[5].place= 7;
ADBanners[5].type = 7;
ADBanners[5].id = 43;

ADBanners[6].htmlcode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="120" height="110"><param name=movie value="http://www.ymmm.com.cn/images/banner/100x100.swf"><param name=wmode value=transparent><param name=quality value=high><embed src="http://www.ymmm.com.cn/images/banner/100x100.swf" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="120" height="110"></embed></object>';
ADBanners[6].weight    = 10;
ADBanners[6].place= 8;
ADBanners[6].type = 8;
ADBanners[6].id = 44;
