var t;
$(document).ready(function(){
	runCards();
	$('#cards').hover(
	function(){
		clearTimeout(t);
		$('#cards').stop().css('opacity',1);
	},
	function(){
		runCards();
	}
	);
});

function runCards()
{
	$('#cards').fadeOut(1000,function(){
		var old = $('#cards img').attr('id');
		var num;
		do { num = Math.floor(Math.random()*cards.length); } while('busCard'+num == old);
		var card = cards[num];
		var img = '<img src="busCards/'+card[0]+'" border=0 alt="'+card[2]+'" id="busCard'+num+'" />';
		if(card[1])
			$(this).html('<a href="'+card[1]+'" target="_blank">'+img+'</a>');
		else
			$(this).html(img);
		$(this).fadeIn(1000);
	});
	t = setTimeout("runCards()",5000);
}

