/*

randomImage.js


*/

	var time_out;
	
	var productImages = new Array("home_blackhat.png","home_bluehat.png","home_crestTee.png","home_helmetTee.png","home_polo.png","home_skullTee.png","home_trackJacket.png","home_vNeckCrestTee.png");
	
	var productPages = new Array("http://gearstore.autoweek.com/New-Era-Autoweek-Cap/dp/B005M4KI4M","http://gearstore.autoweek.com/New-Era-Autoweek-Cap/dp/B005M4L076","http://gearstore.autoweek.com/Gildan-Autoweek-Crest-Tee/dp/B005R0K57G","http://gearstore.autoweek.com/American-Apparel-Autoweek-Helmet-Tee/dp/B005QPQP7G","http://gearstore.autoweek.com/Port-Authority-Autoweek-Polo/dp/B005R0N8BQ","http://gearstore.autoweek.com/American-Apparel-Autoweek-Skull-Tee/dp/B005QQAG1Q","http://gearstore.autoweek.com/American-Apparel-Autoweek-Track-Jacket/dp/B005R0CS80","http://gearstore.autoweek.com/Bella-Autoweek-Womens-Crest-Tee/dp/B005QQ2HSQ");
	
	var productAsin = new Array("B005M4KI4M","B005M4L076","B005R0K57G","B005QPQP7G","B005R0N8BQ","B005QQAG1Q","B005R0CS80","B005QQ2HSQ");
	
	var directory = "/media/Site Files/Merchandising Files/";
	
	var productTitle = new Array("Autoweek Cap","Autoweek Cap","Autoweek Crest Tee","Autoweek Helmet Tee","Autoweek Polo","Autoweek Skull Tee","Autoweek Track Jacket","Autoweek Women's Crest Tee");
	
	var productBrand = new Array("New Era","New Era","Gildan","American Apparel","Port Authority","American Apparel","American Apparel","Bella");
	
	var productSKU = new Array("AWGSA001","AWGSA002","AWGSM003","AWGSM001","AWGSM004","AWGSM002","AWGSU001","AWGSW001");
	
	var productDesc = new Array("Black New Era hat. Autoweek embroidered in gray thread on the back of the hat, arched around the adjustable strap. The Autoweek Jean Behra racing helmet is also embroidered on the front left of the cap. 100% cotton.",
	"Navy New Era hat. Autoweek embroidered in gray thread on the back of the hat, arched around the adjustable strap. The Autoweek Jean Behra racing helmet is also embroidered on the front left of the cap. 100% cotton.",
	"The charcoal gray Autoweek crest T-shirt is a staple for any Autoweek fan. This 100% ultra-cotton, preshrunk Gildan short-sleeve T-shirt is naturally soft, breathable, comfortable and true to size. It includes a rib-knit collar and features the Autoweek crest on the chest and larger on the back of the T-shirt. Machine washable men's T-shirt.",
	"The black Autoweek helmet T-shirt is the perfect casual tee. This 100% cotton T-shirt is naturally soft, breathable and comfortable. It includes a rib-knit collar with the Jean Behra racing helmet and the Autoweek logo on the center of the T-shirt. This fitted tee is an American Apparel men's T-shirt. Machine washable.",
	"The black Autoweek short sleeve polo is 65% polyster and 35% cotton. This Port Authority polo is breathable, comfortable and true to size. The polo includes a pocket on the left chest with the Autoweek logo embroidered in white above the pocket. Machine washable men's polo shirt.",
	"The black Autoweek skull T-shirt is a classic and casual tee. This 100% cotton T-shirt is naturally soft, breathable and comfortable. It includes a rib-knit collar and showcases a design with a skull, pistons, racing flag and Autoweek name in the center of the shirt. The T-shirt is American Apparel and is fitted in size. Machine washable men's T-shirt.",
	"This unisex track jacket is a relaxed fit, zip-up sweatshirt that is great for Fall days. Made of 100% California fleece cotton, it includes a nylon zipper that zips all the way up to the collar. The jacket includes a white Autoweek logo centered on the left chest (3.5 inches wide). Machine washable.",
	"The women's Autoweek crest v-neck tee is fitted in shape and plum in color. It's 100% cotton, naturally soft, breathable and comfortable. It includes a rib-knit collar and features the Autoweek crest on the left chest and the back of the T-shirt. The Autoweek crest tee is a Bella brand T-shirt. Machine washable.");
	
	var numOfImages = productImages.length;
	var full;
	var tempImg;

	var imageNumber;
	var getDiv;
	var theLink;
function rotateImages()
{
	/*for(var count=0; count<productAsin.length; count++)
	{
		pTitle.push(amznAnalytics.getElement("productTitle"));
	}*/
	
	/*get the divs so that the information can be placed in the proper places*/
	getDiv = document.getElementById('imageHolder');
	theLink = document.getElementById('productLink');
	theSKU = document.getElementById('productSKU');
	theBrand = document.getElementById('productBrand');
	theTitle = document.getElementById('productTitle');
	theDesc = document.getElementById('productDesc');
	
	
	imageNumber = Math.floor(Math.random() * (numOfImages));
	full = directory + productImages[imageNumber];
	
	/*set the information in the divs*//*
	getDiv.style.background = "url\('" + full + "'\)";
	getDiv.style.backgroundRepeat = "no-repeat";*/
	getDiv.src = full;
	theLink.href=productPages[imageNumber];
	theTitle.innerHTML = productTitle[imageNumber];
	theSKU.innerHTML = productSKU[imageNumber];
	theBrand.innerHTML = productBrand[imageNumber];
	theDesc.innerHTML = productDesc[imageNumber];
	
	
	time_out = setTimeout("rotateImages()", 5000);
	
}

/*function determines if there are any other functions running on load, runs them, then runs the rotateImages function*/
function init()
{
	if (window.onload) 
	{
		var func = window.onload; 
		window.onload = function() {
			func();
			rotateImages();
		}
	} 
	else 
	{ window.onload = rotateImages; }
}

init();
