am = {};


$(document).bind(
    'resize',
    function()
    {
    	$('.side').height($(document).height());
    }
);

$(window).bind(
	    'resize',
	    function()
	    {
	    	$('.side').height($(document).height());
	    }
	);

jQuery(document).ready(function($) {

	$('.side').height($(document).height());
});

$(document).ready(function(){
	$(".btn-slide").click(function(){
		$("#testdiv").toggle();
		
		$(document).resize();
	});
});

am.visible = 0;

$(document).ready(
	function()
	{
		var numNews = $(".newsLayer").children().length;
		
		for (var i = 0; i < numNews; i++)
		{
			if ( i != am.visible )
			{
				$($(".newsLayer").children()[i]).css("display", "none");
			}
	    }		
		
		var oInt = setInterval(nFlip, 7000);
		
	    $(".newsLayer").mouseover(function() { clearInterval(oInt); });
	    $(".newsLayer").mouseout(function() { oInt = setInterval(nFlip, 7000); });

	    $('.login').click(
	    	function()
	    	{
    			$('.loginBox').animate({width: "toggle"}, "slow");
	    	}
	    );
	    
	}
);

nFlip = function()
{
	var iOld = am.visible;
	
	if ( am.visible >= ( $(".newsLayer").children().length - 1) )
	{
		am.visible = 0;
	}
    
	$($(".newsLayer").children()[iOld]).fadeOut( 1000, function() {
		$($(".newsLayer").children()[(am.visible+1)]).fadeIn( 1500);
		
		am.visible++;
	});
};

