var Banners     = new Array();
var Links       = new Array();
var Peso        = new Array();
var AuxPeso     = new Array();
var Title       = new Array();
var Tipo        = new Array();
var Width       = new Array();
var Height      = new Array();
var Expira      = new Array();
var Ativo       = new Array();
var Data        = new Date();
var sData       = Data.setTime(Data);
var TotalBanner = 0;
var pWidth      = "";
var pHeight     = "";
var Aleatorio;
var IndexPeso;
var StBanner;
var StLink;
var StTitle;
var StWidth;
var StHeight;
var sExpira;
var pWidth;
var pHeight;


  Ativo[0] = 0;
  if (Ativo[0] == 1) {
    Banners[0] = "http://www.andersonnascimento.com/blog/banners/promocao-sao-paulo-2.jpg";
    Links[0] = "http://www.andersonnascimento.com/blog/?p=1112";
    Title[0] = "Promoção 13 EWD-SP";
    Tipo[0] = "IMAGEM";
    Width[0] = "215";
    Height[0] = "125";
    Peso[0] = 1;
  }


  Ativo[1] = 0;
  if (Ativo[1] == 1) {
    Banners[1] = "http://www.andersonnascimento.com/blog/banners/peixe-grande-an-2008.jpg";
    Links[1] = "http://www.peixegrande.com.br/voto/votar3.asp?acao=votar&user=ok&id=335";
    Title[1] = "Peixe Grande AN 2008";
    Tipo[1] = "IMAGEM";
    Width[1] = "215";
    Height[1] = "125";
    Peso[1] = 1;
  }


  Ativo[2] = 0;
  if (Ativo[2] == 1) {
    Banners[2] = "http://www.andersonnascimento.com/blog/banners/1-eti.swf";
    Links[2] = "http://";
    Title[2] = "1º ETI";
    Tipo[2] = "FLASH";
    Width[2] = "215";
    Height[2] = "125";
    Peso[2] = 1;
  }


  Ativo[3] = 0;
  if (Ativo[3] == 1) {
    Banners[3] = "http://www.andersonnascimento.com/blog/banners/design-na-brasa-2008.swf";
    Links[3] = "http://";
    Title[3] = "Design na Brasa 2008";
    Tipo[3] = "FLASH";
    Width[3] = "215";
    Height[3] = "125";
    Peso[3] = 1;
  }


  Ativo[4] = 1;
  if (Ativo[4] == 1) {
    Banners[4] = "http://www.andersonnascimento.com/blog/banners/campus-party-2010-rj.gif";
    Links[4] = "http://www.andersonnascimento.com/blog/?p=1644";
    Title[4] = "Campus Party 2010 RJ";
    Tipo[4] = "IMAGEM";
    Width[4] = "215";
    Height[4] = "125";
    Peso[4] = 1;
  }


Expira[5] = new Date("Feb 13, 2009");
sExpira = Data.setTime(Expira[5]);
if (sData < sExpira) {

  Ativo[5] = 1;
  if (Ativo[5] == 1) {
    Banners[5] = "http://www.andersonnascimento.com/blog/banners/banner-twestival-12-02-09.jpg";
    Links[5] = "http://riodejaneiro.twestival.com";
    Title[5] = "Twestival 12-02-09";
    Tipo[5] = "IMAGEM";
    Width[5] = "215";
    Height[5] = "125";
    Peso[5] = 1;
  }


}


  Ativo[6] = 1;
  if (Ativo[6] == 1) {
    Banners[6] = "http://www.andersonnascimento.com/blog/banners/banner-215-125-seu-blog-merece.jpg";
    Links[6] = "http://blog.cristianoweb.net/?p=683";
    Title[6] = "Seu Blog Merece";
    Tipo[6] = "IMAGEM";
    Width[6] = "215";
    Height[6] = "125";
    Peso[6] = 1;
  }


for (i=0; i <= Banners.length; i++)
{
  if (Peso[i] == undefined) { continue; }
  TotalBanner += Peso[i];
}

Aleatorio = Math.round(Math.random() * (TotalBanner-1));


IndexPeso = 0;
for (i=0; i <= Banners.length; i++)
{
  for (x = 0; x < Peso[i]; x++)
  {
    AuxPeso[IndexPeso] = i;
    IndexPeso++;
  }
}

StBanner  = Banners[AuxPeso[Aleatorio]];
StLink    = Links[AuxPeso[Aleatorio]];
StTitle   = Title[AuxPeso[Aleatorio]];
StWidth   = Width[AuxPeso[Aleatorio]];
StHeight  = Height[AuxPeso[Aleatorio]];

if (StWidth != "")
{
  pWidth = " width='" + StWidth + "'";
}

if (StHeight != "")
{
  pHeight = " height='" + StHeight + "'";
}

if (Tipo[AuxPeso[Aleatorio]] == "IMAGEM")
{
  document.write("<a href='" + StLink + "' target='_blank'><img src='" + StBanner + "' border='0' title='" + StTitle + "'" + pWidth + pHeight + "></a>");
}
else
{
  document.write("<embed src='" + StBanner + "' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' width='" + StWidth + "' height='" + StHeight + "''>");
}
