
$(document).ready( function(){
	
	//Verbergen voor animatie
	$('#tweet-container').css('display', 'none');
	$('#home-footer').css( 'bottom', '16px');
	
	//Hover op enter site image
	$('#enter-site-button').mouseover( function(){ $(this).attr('src', 'images/home/enter-arrow-ov.gif'); });
	$('#enter-site-button').mouseout( function(){ $(this).attr('src', 'images/home/enter-arrow.gif'); });
	
	//Hover op enter site image
	$('#enter-site-button').mouseover( function(){ $('.menu-enter a').css('color', '#03abf6'); });
	$('#enter-site-button').mouseout( function(){ $('.menu-enter a').css('color', '#ffffff'); });
	
	$('.menu-enter a').mouseover( function(){ $('#enter-site-button').attr('src', 'images/home/enter-arrow-ov.gif'); });
	$('.menu-enter a').mouseout( function(){ $('#enter-site-button').attr('src', 'images/home/enter-arrow.gif'); });
	
	$.l_oTweetInterval = setInterval(function() {
         $('#show-tweet-button').trigger('click');
   	}, 3000);
	
	$('#show-tweet-button').click( function(){

		if( $('#tweet-container').is(':hidden') )
		{
			$(this).children().css('color', '#03abf6' );
			$('#tweet-container').slideDown(300);
		}
		else
		{
			$(this).children().css('color', '#ffffff' );
			$('#tweet-container').slideUp(300);
			clearInterval($.l_oTweetInterval);
		}
					
		return false;
	});
	
	$.bAnimate = false;
	$.iFcontentHeight = ( $('#footer-content').outerHeight() + 16 );
	
	$.l_oFooterInterval = setInterval( function() {
		$('#show-footer-button').trigger('click');
	}, 3000 );
	
	$('#show-footer-button').click( function(){
		
		if( !$.bAnimate )
		{	
			$('#footer-content').css('display', 'block');
			
			$( '#home-footer' ).animate( { bottom: $.iFcontentHeight }, 500, function(){ 
				$.bAnimate = true;
			});
			
			$(this).css('color', '#03abf6' ).css('background-color', '#ffffff');
		}
		else
		{
			$( '#home-footer' ).animate( { bottom: 16 }, 500, function(){
				$.bAnimate = false;
			});

			$(this).css('color', '#ffffff' ).css('background-color', '#000000');
			clearInterval($.l_oFooterInterval);
		}
	});
	
	resizeImage();
});

$(window).bind('resize', function() {
	resizeImage();
});

function resizeImage()
{
	var l_iWidth = $(window).width();
	var l_iHeight = $(window).height();

	if( ( l_iWidth / 16 ) > ( l_iHeight / 9 ) )
	{
		newHeight = ( l_iWidth / 16 ) * 9;
		marginTop = ( newHeight - l_iHeight ) / 2;

		$('#home-faux-bg').css( 'width', l_iWidth );
		$('#home-faux-bg').css( 'height', newHeight );
		$('#home-faux-bg').css( 'top', '-'+marginTop+'px' );
		$('#home-faux-bg').css( 'left', '0px' );
	}
	else
	{
		newWidth = ( l_iHeight / 9 ) * 16;
		marginLeft = ( newWidth - l_iWidth ) / 2;

		$('#home-faux-bg').css( 'width', newWidth );
		$('#home-faux-bg').css( 'height', l_iHeight );
		$('#home-faux-bg').css( 'left', '-'+marginLeft+'px' );
		$('#home-faux-bg').css( 'top', '0px' );
	}
}
