// JavaScript Document
<!-- Begin
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 + " title=" + alt + "><img src='" + imgSource + "' width='468' height='60' border='0' alt='" + alt + "'></a>");
}
banner.prototype.dispBanner = dispBanner;
banners = new Array();
banners[0] = new banner("http://www.software4me.net/ar/sponsors/seo.gif",
                        "http://www.software4me.net/SEO/ target='_blank'",
                        "Free&nbsp;SEO&nbsp;Information",
                        30);
banners[1] = new banner("http://www.software4me.net/ar/sponsors/first-aid.gif",
                        "http://www.caninefirst-aid.com target='_blank'",
                        "Canine&nbsp;First-Aid",
                        20);
banners[2] = new banner("http://www.software4me.net/ar/sponsors/doubloons.gif",
                        "http://games.software4me.net/doubloons/ target='_blank'",
                        "Free&nbsp;Full&nbsp;Game&nbsp;Download",
                        30);
banners[3] = new banner("http://www.software4me.net/ar/sponsors/SB468x60.gif",
                        "http://games.software4me.net/shuffleBomb/ target='_blank'",
                        "Free&nbsp;Match3&nbsp;Game&nbsp;Download",
                        20);
///////////////////////////////////////////////////
// banners[x] = new banner(<banner source image>,                                           //                         <url to link to when the banner is clicked>,                     //                         <alt>                                                            //                         <the chance this banner has in which to be randomly selected>);
// To increase the chance of a banner being randomly selected, increase it's corresponding  // 'chance' property relative to the other banners.
///////////////////////////////////////////////////
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 + " title=" + banners[i].alt + "><img src='" + banners[i].imgSource + "' width='468' height='60' border='0' alt='" + banners[i].alt + "'></A>");
return banners[i];
break;
      }
   }
}

randomBanner();
//  End -->

