$(function(){
	/*
	 * Set up product image rotator
	 */
	var timer;
		
	var products = $('ol#product-range li > a');
	products.each(function(){
		var product = $(this);
		product
			.data('info',product.siblings('div').remove())
			.append('<span></span>')
			.mouseover(function(){
				$(this).each(hoverProduct);
				clearTimeout(timer);
			});
	});
	
	nextProduct(0,5000);
	
	function nextProduct(i,t) {
		timer = setTimeout(function(){
			products.eq(i).each(hoverProduct);
			nextProduct(i+1 < products.length ? i+1 : 0, t);
		},t);
	}
	
	function hoverProduct() {
		$('div#product-range-info').html($(this).data('info'));
		$(this).parent('li').find('span').fadeTo(150,1).end().siblings().find('span').fadeTo(150,0.5);
	}
	
});
