jQuery(function () {
	var t1, t2;
	var from = -1;
	var to = 0;

	var len = jQuery('#home-banners li').length;
	if (len > 1) {
		jQuery('#home-banners li:gt(0)').hide();
		// jQuery('#ctrl-banner0').addClass('active');
		t1 = setTimeout(function(){fade(from, to)}, 750);
	}

	function fade(f, t) {
		window.clearTimeout(t1);
		// window.console.log('from = ' + f + ', to = ' + t + '<br />');
		jQuery('.active').removeClass('active');
		jQuery('#ctrl-banner'+t).addClass('active');
		jQuery('#home-banners li:eq('+f+')').fadeOut('slow');
		jQuery('#home-banners li:eq('+t+')').fadeIn('slow');
		// t2 = setTimeout(function(){jQuery('#home-banners li:eq('+t+')').fadeIn('slow');},750);
		to = (t == len-1) ? 0 : t + 1;
		from = t;
		t1 = setTimeout(function(){fade(from,to)},17000);
	}

	jQuery('#banner-control a').each(function() {
		jQuery(this).click(function() {
			to = this.href.substr(this.href.length-1);
			fade(from, to)
			return false;
		});
	});

});
jQuery(document).ready(function(){
	jQuery('#banner-bluemotion').flash({swf: '/img/home/banners/bluemotion_banner.swf',width: 746,height: 329} );
	jQuery('#banner-coty').flash({swf: '/img/home/banners/polo_hatfield.swf',width: 746,height: 329} );
	jQuery('#banner-grandprix').flash({swf: '/img/home/banners/grandprix-748x328.swf',width: 748,height: 329} );
});
