// David Fielden JavaScript Functions

// Fade in menu
jQuery(function( $ ){
	var container = $( "#df-menu-container" );
		$( "a.show-menu" ).click(
			function( event ){
				event.preventDefault();
				if (container.is( ":visible" )){
					container.slideUp( 2000 );
					} else {
					container.slideDown( 2000 );
					}
				}
			);
});

// Full size background image
$(window).load(function() {    
var theWindow = $(window),
	$bg = $("#bg"),
	aspectRatio = $bg.width() / $bg.height();
	function resizeBg() {
		if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
			$bg
				.removeClass()
				.addClass('bgheight');
		} else {
			$bg
				.removeClass()
				.addClass('bgwidth');
		}
	}
	theWindow.resize(function() {
		resizeBg();
	}).trigger("resize");
});
