var tWait = 5000;
var tFade = 1000;
var mutex = false;

function promoSwitch(direction,event) {
	var $active = $('#promo a.active');
	if ( $active.length == 0 ) {$active = $('#promo a:last');};
	if (mutex==false || event==true) {
		if (direction==true) {
			var $next =  $active.next().length ? $active.next() : $('#promo a:first');
			$active.addClass('last-active');
			$next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, tFade, function() { $active.removeClass('active last-active'); });
		} else {
			var $prev =  $active.prev().length ? $active.prev() : $('#promo a:last');
			$active.addClass('last-active');
			$prev.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, tFade, function() { $active.removeClass('active last-active'); });
		}
	}
	mutex=false;
	if (event==true){mutex=true;}
}
$(document).ready(function(){
	if($("div#promo a").size()){promoSwitch(true);promotimer=setInterval("promoSwitch(true)",tWait);}
});

