/*
	rotate images

	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 = 4

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

//  not using preload array cuz we don't need to waste the time
fimage1 = "skin1/banners/SoapGroup320.jpg "
fimage2 = "skin1/banners/Beauty-mi-Face320.jpg "
fimage3 = "skin1/banners/NewShampoo320.jpg "
fimage4 = "skin1/banners/mi-lotion-new320.jpg "



//  corresponding urls
url1 = "http://www.mi-spa.com/Rice-Soap-c-1.html"
url2 = "http://www.mi-spa.com/Face-c-3.html"
url3 = "http://www.mi-spa.com/Hair-c-2.html"
url4 = "http://www.mi-spa.com/mi-lotion-pr-49.html"



//  corresponding alt text
alt1 = "mi SPA rice soaps"
alt2 = "Beauty-mi-Face Soap"
alt3 = "Shampoo-mi Bar"
alt4 = "mi-lotion"




//  corresponding title text
title1 = "mi SPA rice soaps"
title2 = "Beauty-mi-Face Soap"
title3 = "Shampoo-mi Bar"
title4 =  "mi-lotion"




//  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
}