// JavaScript Document
var the_banner = 1;
var prev_banner = 1;
var min_banner = 1;
var max_banner = 3;
var banner_timer = null;
function rotate_banner(ix){
prev_banner = the_banner;
if(ix){
if(ix > max_banner || ix < min_banner){
ix=1;
}
the_banner = ix;
clearInterval(banner_timer);
}else{
the_banner+=1;
}
if(the_banner>max_banner){
the_banner = min_banner;
prev_banner = max_banner;
}
$('.banner_radio').removeClass('radio-on');
$('#banner_radio_'+the_banner).addClass('radio-on');
$('#theholder'+prev_banner).css({zIndex:1});
$('#theholder'+the_banner).css({zIndex:5});
$('#theholder'+the_banner).animate({ opacity: '1'}, {queue: false , duration:1000} );
$('#theholder'+prev_banner).animate({ opacity: '0'}, {queue: false , duration:1000} );
if(ix){
if(banner_timer){
clearInterval(banner_timer)
}
banner_timer = setInterval(function(){rotate_banner()},10000);
}
}
$(window).load(function(){
$('.banner-holder:not(#theholder1)').css('height','366px');
$('.banner-holder:not(#theholder1)').css({opacity:'0',display:'block'});
$('.banner_radio').css({cursor:'pointer'}).click(function(){
rotate_banner(parseInt($(this).attr('id').substr(13)));
return false;
});
banner_timer = setInterval(function(){rotate_banner()},5000);
});
