
var siteNoticeChangeInterval = 10;

$(document).ready(function() {
	$('#site-notice ul li:first').fadeIn('slow').addClass('flagNotice');
	
	if($('#site-notice ul').children().size() > 1){
		noticeInterval = setInterval("rotateNotice()",siteNoticeChangeInterval*1000);
	}
});


function rotateNotice(){
	
	$('.flagNotice').fadeOut('slow',function(){
		$(this).removeClass('flagNotice');
		
		//check if we are on last element by checking class = 'last'
		if( $(this).filter('.last').size() ){
			$('#site-notice ul li:first').fadeIn('slow').addClass('flagNotice');
		}else{
			$(this).next().fadeIn('slow').addClass('flagNotice');
		}
	});
	
}
