// Rotate Banner Ads (select one randomly); by Fred Brack, October 2003, for CellarExchange.com
// You may suppress a banner ad by setting "ad=0" AND not altering the variable "url"
// If "ad=0" AND "url" is set, then the "switch/case" section will be ignored in presenting your ad
// If an advertiser has more than one ad to rotate, include separate code to rotate within their "case" statement
// To overweight an advertiser, up the advertiser count and alter "ad" before the "switch" statement
// Example:  to weight the first of 3 advertisers double, "advertisers=4" (one extra weighting); then "if ad==4 {ad=1}"
//           OR increase "advertisers" but let "default" pick up the ad

// IMPORTANT!  Enter the number of advertisers below (or 1 higher, to allow the default add to display, too)
advertisers = 2
// Should be 3 -- suppressed on Dec 12th until DEFAULT ad can be changed ...

// Set program defaults
url = ""
width="468";
height="60";
function randnum(n) {
	var rn=Math.floor(Math.random()*n)
	rn +=1
	return(rn)
}

// Generate a random number (ad) between 1 and advertisers
ad = randnum(advertisers)

// Select the advertiser based on the random number (ad)
switch (ad) {

case 0 :
	// NO AD (via this process, anyway)
	break;

case 1 :
	// CELLAR! (rotate 2 versions)
	sub_ad = randnum(2);
	sub_ad +=1 // these Cellar! ads start with suffix 2...
	txt="Cellar\! - Wine Cellar Management Software";
	url="https://secure.bmtmicro.com/ECommerce-OffSite/153order.html?AID=651741";
	alt=txt;
	banner="http://65.17.240.220/html/cellar_banner" + sub_ad + ".gif";
	break;

case 2 :
	// THE WINE ENTHUSIAST, updated Feb 21, 2007, from Performics
	txt="Free Shipping on Riedel Glassware at Wine Enthusiast!";
	url="http://clickserve.cc-dt.com/link/tplclick?lid=41000000023702990&pubid=21000000000036220";
	alt="The Wine Enthusiast";
	banner="http://clickserve.cc-dt.com/link/tplimage?lid=41000000023702990&pubid=21000000000036220";
	width="392";
	height="72";
	break;

case 3 :
	// AUCTION-EXPRESS
	txt="Auction-Express:  Build Your Own Auction Website";
	url="http://www.gletech.com/corporate/affiliates.cgi?affiliate=cellarexchange&amp;product_id=AE";
	alt="Auction-Express";
	banner="http://65.17.240.220/html/auctionexpressban1.gif";
	break;

//SUPPRESSED case 8 :
	// GIFTS FOR PROFESSIONALS
	sub_ad = randnum(1);
	url="http://www.giftsforprofessionals.com/small-leather-goods-wine-accessories--wine-cases---wine-holders.html";
	alt="Gifts for Professionals";
        txt="Wine cases and holders make wonderful gifts at Gifts for Professionals!";
	banner="http://65.17.240.220/html/gfpban" + sub_ad + ".gif";
	break;

default :
	// CELLAREXCHANGE.COM
	txt="Advertise Here on CellarExchange.Com!";
	url="http://65.17.240.220/html/media.html";
	alt="Advertise Here on CellarExchange.Com!";
	banner="http://65.17.240.220/html/cellarban1.gif";
}

if (url!="") {
	document.write('<p align=\"center\">')
	document.write('<a href=\"' + url + '\" target=\"_blank\">')
	document.write('<img src=\"' + banner + '\" width=\"')
	document.write(width + '\" height=\"' + height + '\" ')
	document.write('alt=\"' + alt + '\" border=\"1\"><br>')
	document.write('<small>' + txt + '</small></a>')
	document.write('</p>')
}
// End
