featured = {
	products: [],
	imageObj: null,
	contentObj: null,
	toRotate: [],
	rotateKey: 0,
	timeOutInterval: 8000,
	timeOut: null,
	preLoader: new Image(),
	moreDetails: 'more details'
};
featured.products[98] = {
	ID: 98,
	title: 'Househam Spraycare 1000L MM (ID98)',
	hours: '0',	
	summary: '',
	price: '&pound;0 (6999)',
	href: '/en/preowned/ex-spraycare-15m-x-fold.htm',
	image: {
		src: '/library/featured/ID98-feature2.jpg',
		alt: '',
		height: '275'
	},
	brand: 'Househam Spraycare'
};


function initFeaturedProductRotate()
{	
	var count = 0;
	for(key in featured.products) {
		if(featuredConfig['start']==key) {
			var startingFeature = key;
		}
		else {
			featured.toRotate[count] = key;
			count ++;
		}
	}
	
	// Add the starting featured product to the end of the rotate array
	featured.toRotate[count] = startingFeature;
	
	// fetch the div#feature_content object
	featured.contentObj = document.getElementById('featured_content');
	
	// fetch the img#featured_image object
	featured.imageObj = document.getElementById('featured_image');
	
	// Preload the next image
	featured.preLoader.src=
		featured.products[featured.toRotate[featured.rotateKey]].image.src;
	
	
	// Initalise the banner rotation
	if(featured.toRotate.length>1) {
		featured.timeOut = setTimeout('featuredProductRotate()', featured.timeOutInterval);
	}
}

/**
 * Object Converter
 * Converts an Array into an Object
 */
function oc(a) {
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]]='';
  }
  return o;
}


/**
 * Rotates the banner image
 */
function featuredProductRotate() {
	var product = featured.products[featured.toRotate[featured.rotateKey]];
	
	var content = '<h2><a href="'+product.href+'">'+product.title+'</a></h2>';
	content += '<p>'+product.summary+'</p>';
	content += '<p><strong>Brand:</strong>&nbsp;'+product.brand+'<br />';
	content += '<strong>Hours:</strong>&nbsp;'+product.hours+'<br />';
	content += '<strong>Price:</strong>&nbsp;'+product.price+'</p>';
	content += '<a href="'+product.href+'" class="button_orange">'+featured.moreDetails+'</a>';
	
	featured.contentObj.innerHTML = content;
	
	featured.imageObj.src = product.image.src;
	featured.imageObj.alt = product.image.alt;
	featured.imageObj.title = product.title;
	featured.imageObj.height = product.image.height;
	
	featured.rotateKey++;	
	if(featured.rotateKey>=featured.toRotate.length) { featured.rotateKey=0; }
	
	// Preload the next image
	featured.preLoader.src=featured.products[featured.toRotate[rotateKey]].image.src;
	
	clearTimeout(featured.timeOut);
	featured.timeOut=setTimeout('featuredProductRotate()', featured.timeOutInterval);
	
	return;
} // end func bannerRotate