var curIndex = 1;
var curTimeout = null;

$(window).load(function() {
	$('#mainbox-wrapper').hover(
	function() {
		clearInterval(curTimeout);
	},
	function() {
		curTimeout = setInterval(fpScroll, 6000);
	}
	);
	
	$('#news1').fadeIn('fast');
	$('#news_img'+curIndex).css({'opacity': '1.0', 'filter': 'alpha(opacity=100)'});
	curTimeout = setInterval(fpScroll, 6000);
});

function fpScroll()
{
	$('#news'+curIndex).fadeOut('fast', function() {
		$('#news_img'+curIndex).css({'opacity': '0.35', 'filter': 'alpha(opacity=35)'});
		curIndex++;
		if($('#news'+curIndex).length == 0) { curIndex = 1; }
		$('#news_img'+curIndex).css({'opacity': '1.0', 'filter': 'alpha(opacity=100)'});
		$('#news'+curIndex).fadeIn('fast', function() {
		});
	});
}

function fpSelect(num)
{
	$('#news'+curIndex).fadeOut('fast', function() {
		$('#news_img'+curIndex).css({'opacity': '0.35', 'filter': 'alpha(opacity=35)'});
		curIndex = num;
		$('#news_img'+curIndex).css({'opacity': '1.0', 'filter': 'alpha(opacity=100)'});
		$('#news'+curIndex).fadeIn('fast', function() {
		});
	});
}

