jQuery(document).ready( function(){
	
	// Achtergrond afbeelding schalen adv scherm
	resizeImage();
});

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

function resizeImage()
{
	var l_iWidth = jQuery(window).width();
	var l_iHeight = jQuery(window).height();
	var l_iHeaderHeight = jQuery('#header').outerHeight();
	
	if( ( l_iWidth / 16 ) > ( l_iHeight / 9 ) )
	{
		newHeight = ( l_iWidth / 16 ) * 9;
		marginTop = ( newHeight - l_iHeight ) / 2;
		
		marginTop = marginTop - l_iHeaderHeight;
		
		jQuery('#faux-bg').css( 'width', l_iWidth );
		jQuery('#faux-bg').css( 'height', newHeight );
		jQuery('#faux-bg').css( 'top', '-'+marginTop+'px' );
		jQuery('#faux-bg').css( 'left', '0px' );
	}
	else
	{
		newWidth = ( l_iHeight / 9 ) * 16;
		marginLeft = ( newWidth - l_iWidth ) / 2;

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

