<!--  AD rotator script written entirely in JavaScript  -->
<!--  Welcome to www.forumcn.com. -->

function runCode()  //定义一个运行代码的函数，
{
  var code=event.srcElement.parentElement.children[0].value;//即要运行的代码。
  var newwin=window.open('','','');  //打开一个窗口并赋给变量newwin。
  newwin.opener = null // 防止代码对论谈页面修改
  newwin.document.write(code);  //向这个打开的窗口中写入代码code，这样就实现了运行代码功能。
  newwin.document.close();
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

// 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
}

// 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);
}

var ADBanners = new Array();

CreatBanners(ADBanners, 12);

ADBanners[0].imgsrc    = "/images/ad/rsc300-250.gif";
ADBanners[0].href = "http://www.riscn.com/";
ADBanners[0].imgwidth  = "300";
ADBanners[0].imgheight = "250";
ADBanners[0].imgalt    = "日昇昌财经社区";
ADBanners[0].weight    = 5;
ADBanners[0].place= 2;
ADBanners[0].type = 2;

ADBanners[1].imgsrc    = "/images/ad/rsc160-600.gif";
ADBanners[1].href = "http://www.riscn.com/";
ADBanners[1].imgwidth  = "160";
ADBanners[1].imgheight = "600";
ADBanners[1].imgalt    = "日昇昌财经社区";
ADBanners[1].weight    = 5;
ADBanners[1].place= 1;
ADBanners[1].type = 1;

ADBanners[2].imgsrc    = "/images/ad/rsc468-60.gif";
ADBanners[2].href = "http://www.riscn.com/";
ADBanners[2].imgwidth  = "468";
ADBanners[2].imgheight = "60";
ADBanners[2].imgalt    = "日昇昌财经社区";
ADBanners[2].weight    = 5;
ADBanners[2].place= 6;
ADBanners[2].type = 6;

ADBanners[3].imgsrc    = "/images/ad/mbz300-250.gif";
ADBanners[3].href = "http://www.riscn.com/viewthread.php?tid=5&extra=page%3D1";
ADBanners[3].imgwidth  = "300";
ADBanners[3].imgheight = "250";
ADBanners[3].imgalt    = "日昇昌财经社区招募版主";
ADBanners[3].weight    = 5;
ADBanners[3].place= 2;
ADBanners[3].type = 2;

ADBanners[4].htmlcode  = '<script type="text/javascript">google_ad_client = "pub-7064870657136822";google_ad_width = 468;google_ad_height = 60;google_ad_format = "468x60_as";google_ad_type = "text_image";google_ad_channel ="1825738722";google_color_border = "F0F0F0";google_color_bg = "F0F0F0";google_color_link = "0000FF";google_color_url = "008000";google_color_text = "000000";</script><script type="text/javascript"  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
ADBanners[4].weight    = 20;
ADBanners[4].place= 3;
ADBanners[4].type = 3;

ADBanners[5].imgsrc    = "/images/ad/blog468.gif";
ADBanners[5].href = "http://www.ibsky.com/";
ADBanners[5].imgwidth  = "468";
ADBanners[5].imgheight = "60";
ADBanners[5].imgalt    = "财经博客派";
ADBanners[5].weight    = 5;
ADBanners[5].place= 3;
ADBanners[5].type = 3;

ADBanners[6].imgsrc    = "/images/ad/blog300.gif";
ADBanners[6].href = "http://www.ibsky.com/";
ADBanners[6].imgwidth  = "300";
ADBanners[6].imgheight = "250";
ADBanners[6].imgalt    = "财经博客派";
ADBanners[6].weight    = 5;
ADBanners[6].place= 3;
ADBanners[6].type = 3;

ADBanners[7].imgsrc    = "/images/ad/rsca468-60.gif";
ADBanners[7].href = "http://www.riscn.com";
ADBanners[7].imgwidth  = "468";
ADBanners[7].imgheight = "60";
ADBanners[7].imgalt    = "日昇昌财经社区";
ADBanners[7].weight    = 5;
ADBanners[7].place= 6;
ADBanners[7].type = 6;

ADBanners[8].imgsrc    = "/images/ad/hnjr.gif";
ADBanners[8].href = "http://www.forumcn.com/gongsi/ad/hnjr.htm";
ADBanners[8].imgwidth  = "220";
ADBanners[8].imgheight = "24";
ADBanners[8].imgalt    = "愿海南金融成为经济学子的研究园地";
ADBanners[8].weight    = 5;
ADBanners[8].place= 6;
ADBanners[8].type = 6;

ADBanners[9].htmlcode  = '<iframe src="http://www.joyo.com/union/eb.asp?k=56&source=forumcn" width="200" height="210" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>';
ADBanners[9].weight    = 5;
ADBanners[9].place= 2;
ADBanners[9].type = 2;

ADBanners[10].htmlcode  = '<a href="http://www.forumcn.com/gongsi/ad/hnjr.htm" target="_blank">愿海南金融成为经济学子的研究园地</a>';
ADBanners[10].weight    = 5;
ADBanners[10].place= 6;
ADBanners[10].type = 6;

ADBanners[11].htmlcode  = '<a href="http://bbs.forumcn.com/viewthread.php?tid=5&extra=page%3D1" target="_blank">日升昌财经社区诚募斑竹中</a>';
ADBanners[11].weight    = 10;
ADBanners[11].place= 7;
ADBanners[11].type = 7;

