/*
	rotate banners

	7/8/05 RedLime Web Development
	limes@redlimeweb.com

	12/28/05 - allow for two dissimilar features

	supply feature images, urls, alts, and titles
	simply call rotateBanners()
*/

//  how many features?
var numFeatures = 7

//  override rand for testing: true or false
var override = false
//  iced tea is now permanent
var overrideNum = 7

//  not using preload array cuz we don't need to waste the time
fimage1 = "banners/plur-468x60.gif"
fimage2 = "banners/fp-468x60.gif"
fimage3 = "banners/ss-468x60.gif"
fimage4 = "banners/dd-468x60.gif"
fimage5 = "banners/aj-468x60.gif"
fimage6 = "banners/rl-468x60.gif"
fimage7 = "banners/gc-468x60.gif"

//  corresponding urls
url1 = "http://plurnaturals.com"
url2 = "http://flower-peddler.com"
url3 = "http://soapies-supplies.com"
url4 = "http://desertdancer.net"
url5 = "http://ajscountrycottage.com"
url6 = "http://redlimeweb.com"
url7 = "http://gardenchick.com"

//  corresponding alt text
alt1 = "Plur Naturals"
alt2 = "Flower Peddler"
alt3 = "Soapies Supplies"
alt4 = "Desert Dancer"
alt5 = "AJs Country Cottage"
alt6 = "RedLime Web"
alt7 = "GardenChick"

//  corresponding title text
title1 = "Plur Naturals"
title2 = "Handcrafted Soaps and Toiletries"
title3 = "Soapmaking Supplies"
title4 = "Custom Scented Lotions"
title5 = "Highly Scented Soy Candles"
title6 = "Website Design and Development"
title7 = "GardenChick"

//  set up random number seeds
rnd.today = new Date()
rnd.seed = rnd.today.getTime()

//  return random base for making random number
function rnd() {
	rnd.seed = (rnd.seed*9301+49297) % 233280
	return rnd.seed/(233280.0)
};

//  build the real random integer
var rand = Math.ceil(rnd()*numFeatures)

//  override rand for testing
if (override) { rand = overrideNum }

//  second random integer
var rand2 = rand
while (rand2 == rand)
	rand2 = Math.ceil(rnd()*numFeatures)

//  sets feature attributes randomly
//  feature - id name of feature a
//  fnum - feature number, which one
//  band - bandwidth, low or high
function rotateBanners(feature,fnum,band) {
	var bannerRotation = document.getElementById(feature)

	//  which random number to use?
	var fran = (fnum == 1) ? rand : rand2

	var title = eval("title" + fran)

	if (band == "low") {
		var content = title
		bannerRotation.innerHTML = content
	} else {
		var feat = eval("document." + feature)
		feat.src = eval("fimage" + fran)
		feat.alt = eval("alt" + fran)
	}

	bannerRotation.href = eval("url" + fran)
	bannerRotation.title = title
}

