<!-- 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 + "> <IMG SRC='" + imgSource + "' WIDTH=216 HEIGHT=250 BORDER=0 ALT='" + alt + "'></A>");
}
banner.prototype.dispBanner = dispBanner;
banners = new Array();
banners[0] = new banner("http://www.venira.ru/images/banner_8.gif", //баннер 1 - 16 процентов
"http://www.venira.ru/category/podarki-i-suveniry-k-8-marta/ target='_self'",
" ",
50);
banners[1] = new banner("http://www.venira.ru/images/banner_1.gif", //баннер 2 - 50 процентов
"http://www.venira.ru/suveniry-iz-metalla/ target='_self'",
" ",
25);
banners[2] = new banner("http://www.venira.ru/images/banner_9.gif", //баннер 3 - 33 процента
"http://www.venira.ru/category/podarki-k-23-fevralja/ target='_self'",
" ",
25);
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 + "> <IMG SRC='" + banners[i].imgSource + "' WIDTH=216 HEIGHT=250 BORDER=0 ALT='" + banners[i].alt + "'></A>");
return banners[i];
break;
}
}
}
// End -->
