var ban=Math.floor(Math.random( ) * (3));
var ban_temp=ban;
var next_ban;
var bl;
function updateBanLink(){
	switch(ban_temp){
		case 0: bl="location.href='/news/id.15208/'";break;
		case 1: bl="location.href='/fan/supermarket/season_ticket/'";break;
		case 2: bl="location.href='/fan/supermarket/season_ticket/sales/'";break;
		default: bl="";
	}
}
function updateBan(){
	while (ban==ban_temp) {ban_temp=Math.floor(Math.random( ) * (3));}
	updateBanLink();
	next_ban="/i/public/banner_"+ban_temp+".gif";
	$.preloadImages(next_ban);
	ban=ban_temp;
	$('#banner_bottom').fadeOut('def',function(){
							$('#banner_bottom').attr('src',next_ban);
							$('#banner_bottom').fadeIn('def');
							$('#banner_bottom').attr('onClick',bl);
							if(bl!="")$('#banner_bottom').attr('style','cursor:pointer');
							else $('#banner_bottom').attr('style','');
							});
	setTimeout('updateBan();', 12000);
}


var ra=Math.floor(Math.random( ) * (2));
var rn=ra;
var next_pic;
var rl;
function updateLink(){
	switch(rn){
		case 0: rl="location.href='/fan/supermarket/season_ticket/'";break;
		case 1: rl="location.href='/fan/supermarket/ticket/'";break;
		default: rl="";
	}
}
function updateImage(){
    while (ra==rn) {
		rn=Math.floor(Math.random( ) * (2));
	}
	updateLink();
	next_pic="/i/public/s103_center_"+rn+".jpg";
	ra=rn;
	$.preloadImages(next_pic);
    $('#center_image').fadeOut('def',function(){
							$('#center_image').attr('src',next_pic);
							$('#center_image').fadeIn('def');
							$('#center_image').attr('onClick',rl);
							if(rl!="")$('#center_image').attr('style','cursor:pointer');
							else $('#center_image').attr('style','');
							});
    setTimeout('updateImage();', 10000);
}
$(document).ready(function(){
	updateLink();
	updateBanLink();
							$('#center_image').attr('onClick',rl);
							if(rl!="")$('#center_image').attr('style','cursor:pointer');
							else $('#center_image').attr('style','');

							$('#banner_bottom').attr('onClick',bl);
							if(bl!="")$('#banner_bottom').attr('style','cursor:pointer');
							else $('#banner_bottom').attr('style','');

	$('#center_image').attr('src',"/i/public/s103_center_"+rn+".jpg");setTimeout('updateImage();', 10000);
	$('#banner_bottom').attr('src',"/i/public/banner_"+ban_temp+".gif");setTimeout('updateBan();', 6000);
});


