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 + "><IMG SRC='" + imgSource + "' BORDER=0 ALT='" + alt + "'></A>");
}
banner.prototype.dispBanner = dispBanner;
banners = new Array();

banners[0] = new banner("images/baneri/beotel_logo.gif",
                        "http://www.beotel.net/",
                        "BeotelNet",
                        40);

banners[1] = new banner("images/baneri/ban3.gif",
                        "http://www.vojvodina.co.yu",
                        "Privredni index Vojvodine",
                        20);

banners[2] = new banner("images/baneri/ban21.gif",
                        "http://www.satto.co.yu",
                        "Satto",
                        10);

banners[3] = new banner("images/baneri/vojvodinaonline.jpg",
                        "http://www.vojvodinaonline.com",
                        "vojvodinaonline",
                        20);

banners[4] = new banner("images/baneri/jk-vojvodina.jpg",
                        "http://www.vojvodina.com/jedrilicari/index.htm",
                        "Jedriličarski klub Vojvodina",
                        20);





sum_of_all_chances = 0;
for (i = 0; i < banners.length; i++) {
sum_of_all_chances += banners[i].chance;
}
function ShowTheBanner() {
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 + "><IMG SRC='" + banners[i].imgSource + "' BORDER=0 ALT='" + banners[i].alt + "'></A>");
return banners[i];
break;
      }
   }
}
