// JavaScript Document
$(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");

});



$(document).ready(function() {
	
		
		
		$('#main').css("margin", "0 auto -"+$('#footer').height()+"px");
		$('.push').css("height", +$('#footer').height()+"px");
		$('#footernav ul li:first').addClass("nostyle");
		$('#catnav ul li:first').addClass("nostyle");
		$('.subnav ul').each(function(){
			$(this).find('li:first').addClass("nostyle");
		}); 
		 
		
		
	
		$('.subnav').hide();
		
		$('.navitem').click(function(){
			
			$('.subnav').hide("fast");
			$(this).parent(".nav").find(".subnav").toggle("fast");
			//$(this).parent(".nav").find(".subnav").toggleClass("visible");
		
		});
	
	
	
});
