// JavaScript Document

// <SCRIPT LANGUAGE="javascript">
<!--
function banner(imgSource,url,alt,chance) {
this.imgSource = imgSource;
this.url = url;
this.alt = alt;
this.chance = chance;
}
function dispBanner() {
with (this) document.write("<A HREF=" + url + " target=_blank><IMG SRC='" + imgSource + "' WIDTH=168 HEIGHT=74 BORDER=0 ALT='" + alt + "'></A>");
}
banner.prototype.dispBanner = dispBanner;
banners = new Array();

banners[0] = new banner("apoio/velox01.jpg",
"http://www.velox.com.br",
"Velox01",
3);
banners[1] = new banner("apoio/telemar01.jpg",
"http://www.telemar.com.br",
"Telemar01",
3);
banners[2] = new banner("apoio/velox02.jpg",
"http://www.velox.com.br",
"Velox02",
3);
banners[3] = new banner("apoio/telemar02.jpg",
"http://www.telemar.com.br",
"Telemar02",
3);
sum_of_all_chances = 0;
for (i = 0; i < banners.length; i++) {
sum_of_all_chances += banners[i].chance;
}
function randomBanner() {
chance_limit = 0;
randomly_selected_chance = Math.round((sum_of_all_chances - 1) * Math.random()) + 1;
for (i = 0; i < banners.length; i++) {
chance_limit += banners[i].chance;
if (randomly_selected_chance <= chance_limit) {
document.write("<A HREF=" + banners[i].url + " target=_blank><IMG SRC='" + banners[i].imgSource + "' WIDTH=168 HEIGHT=74 BORDER=0 ALT='" + banners[i].alt + "'></A>");
return banners[i];
break;
}
}
}
// End -->
// /SCRIPT>