var current = -1;
var showtime = 7500; 
var headlineCount = 0;

$(document).ready(function(){ 
	$(".headline-item").hide();
	headlineCount = $(".headline-item").size()-1;
	if(headlineCount == 0){
		fadeLineIn(0);
	}else if(headlineCount > 0){
		gotoNext();
	}
	/* - removed due to being annoying...
	$(".submenu-linkitem").hover(function(){
		$(this).css({'padding-left': '20px'});
	}, function(){
		$(this).css({'padding-left': '0px'});
	});
	*/
	$(".mainmenu-item").click(function(){
		var gotoPage = $(this).attr('gotopage');			  
			location.href(gotoPage);
	});
	$(".mainmenu-item-selected").click(function(){
		var gotoPage = $(this).attr('gotopage');			  
			location.href(gotoPage);
	});	
});

function fadeLineIn(counter){
	$(".headline-item:eq("+counter+")").fadeIn("slow");
}
function fadeLineOut(counter){
	$(".headline-item:eq("+counter+")").hide(0, gotoNext());
}
function gotoNext(){
	current++;
	if(current > headlineCount){
		current = 0;
	}	
	fadeLineIn(current);
	setTimeout("fadeLineOut("+current+")", showtime);	
}