// 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 = 4
// Should be 5 -- 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)

// Special Processing for CHICAGO WINE COMPANY
myloc = " " + window.location
myfile = myloc.substring(myloc.length-13)
if (myfile=="appraise.html") {
	// CHICAGO WINE COMPANY
	txt="The Chicago Wine Company";
	url="http://www.tcwc.com/";
	alt=txt;
	banner="http://65.17.240.220/html/tcwcban1.gif";
	ad = 0
}

// Select the advertiser based on the random number (ad)
switch (ad) {

case 0 :
	// NO AD (via this process, anyway)
	break;

case 1 :
	// BRACKSCO
	sub_ad = randnum(6);
	url="http://www.bracksco.com";
	alt="Bracksco Wine Nook - Featuring VintageView Wine Racks";
	txt="Bracksco Wine Nook - Featuring VintageView Wine Racks and Personalized Wine Accessories";
	banner="http://65.17.240.220/html/brackscoban" + sub_ad + ".gif";
	break;

case 2 :
	// 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 3 :
	// 55 DEGREES
	sub_ad = randnum(1);
	url="http://www.fiftyfivedegrees.com";
	alt="55 Degrees";
        txt="55 DEGREES - the perfect spot to store your wines until you are ready to ship them";
	banner="http://65.17.240.220/html/55degreesban" + sub_ad + ".gif";
	break;

case 4 :
	// DOUG PARSONS REAL ESTATE
	sub_ad = randnum(1);
	url="http://www.dougparsonsrealestate.com";
	alt="Doug Parsons Real Estate";
        txt="Doug specializes in real estate in the Raleigh and Triangle area of NC";
	banner="http://65.17.240.220/html/DP" + sub_ad + ".gif";
	break;

//case 5 :
	// TWE
	url="http://www.trianglewineexperience.org/";
	alt="Triangle Wine Experience";
        txt="Support the Frankie Lemmon School by attending a Triangle Wine Experience event!";
	banner="http://65.17.240.220/html/twebanner.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
	sub_ad = randnum(2);
	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/cellarban" + sub_ad + ".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
