function hide(){
    if ($(window).width() < 1050) {
    	$('body').css('width','1000px');
		$('').css('','');
    }else{
    	$('body').css('width','auto');
    }
}

$(function(){
		
		
	//on load
    hide();

    //on resize
    $(window).resize(function(){
        hide();
    });
		
	/*var rotation = function (){
	   $(".propeller").rotate({
		  angle:0, 
		  animateTo: -1440, 
		  
	   });
	}
	rotation();*/


	var lastBlock = $('');
    //var maxWidth = 760;
    //var minWidth = 33;	

    $("#accordian li").click(function(){
		if($('#accordian').width() = 170) {
			$('#accordian').animate({width: '550px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: '80px'}, {queue: false, duration: 800});
        	$(lastBlock).animate({width: "33px"}, { queue:false, duration: 800 });
		}
		if($('#accordian').width() = 972) {
			$('#accordian').animate({width: '972px'}, {queue: false, duration: 0});
			$('#red-propeller').animate({width: '80px'}, {queue: false, duration: 800});
        	$(lastBlock).animate({width: "33px"}, { queue:false, duration: 800 });
		}
		lastBlock = this;
    });
		
	var cache = {
		'': $('.bbq-default')
	};
	
	$(window).bind( 'hashchange', function(e) {
				
		if(window.location.hash == '' || window.location.hash == '#'){
			$('#accordian').animate({width: '173px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: "0"}, { queue:false, duration: 800 });
			$('#accordian li').animate({width: "33px"}, { queue:false, duration: 800 });
			$('#images img').not('#images img#cap').fadeOut(500);
			$('#images img#cap, #home').delay(500).fadeIn(200);
			$('.bbq-content, #phone, #privacy').hide();
		}
		
		if(window.location.hash == '#contact.html'){
			$('#accordian').animate({width: '173px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: "0"}, { queue:false, duration: 800 });
			$('#accordian li').animate({width: "33px"}, { queue:false, duration: 800 });
			$('#images img').not('#images img#telephone').fadeOut(500);
			$('#images img#telephone, #phone').delay(500).fadeIn(200);
			$('.bbq-content, #home, #privacy').hide();
		}
		
		if(window.location.hash == '#privacy.html'){
			$('#accordian').animate({width: '173px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: "0"}, { queue:false, duration: 800 });
			$('#accordian li').animate({width: "33px"}, { queue:false, duration: 800 });
			$('#images img').not('#images img#hugo').fadeOut(500);
			$('#privacy').show(); // had to immediately show this because of the scroll pane //
			$('#images img#hugo').delay(500).fadeIn(200);
			$('.bbq-content, #home, #phone').hide();
			$('#privacy').jScrollPane({showArrows: false});
		}
		
		if(window.location.hash == '#who-knew.html'){
			$('#accordian').animate({width: '550px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: '80px'}, {queue: false, duration: 800});
			$('.block').animate({width: "33px"}, { queue:false, duration: 800 });
			$('#who-knew').animate({width: "410px"}, { queue:false, duration: 800});
			$('#images img, #home, #phone, #privacy').fadeOut(100);
			$('#images img#stick').delay(500).fadeIn(200);
			$('.bbq-content').hide();
			$('#who-knew').find('.bbq-content').fadeIn(300);
			var url = $.param.fragment();
			$('#who-knew').find( 'a.bbq-current' ).removeClass( 'bbq-current' );
			$('#who-knew').find( '.bbq-content' ).children( ':visible' ).hide();
			url && $( 'a[href="#' + url + '"]' ).addClass( 'bbq-current' );
			if ( cache[ url ] ) {
			  cache[ url ].show();
			} else {
			  $('#who-knew').find( '.bbq-loading' ).show();
			  cache[ url ] = $( '<div class="bbq-item"/>' )
				.appendTo( '#who-knew .bbq-content' )
				.load( url, function(){
				  $( '#who-knew .bbq-loading' ).hide();
				});
			}
		}
		
		if(window.location.hash == '#who-we-are.html'){
			$('#accordian').animate({width: '550px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: '80px'}, {queue: false, duration: 800});
			$('.block').animate({width: "33px"}, { queue:false, duration: 800 });
			$('#who-we-are').animate({width: "410px"}, { queue:false, duration: 800});
			$('#images img, #home, #phone, #privacy').fadeOut(100);
			$('#images img#needle').delay(500).fadeIn(200);
			$('.bbq-content').hide();
			$('#who-we-are').find('.bbq-content').fadeIn(300);
			var url = $.param.fragment();
			$('#who-we-are').find( 'a.bbq-current' ).removeClass( 'bbq-current' );
			$('#who-we-are').find( '.bbq-content' ).children( ':visible' ).hide();
			url && $( 'a[href="#' + url + '"]' ).addClass( 'bbq-current' );
			if ( cache[ url ] ) {
			  cache[ url ].show();
			} else {
			  $('#who-we-are').find( '.bbq-loading' ).show();
			  cache[ url ] = $( '<div class="bbq-item"/>' )
				.appendTo( '#who-we-are .bbq-content' )
				.load( url, function(){
				  $( '#who-we-are .bbq-loading' ).hide();
				});
			}
		}
		
		if(window.location.hash == '#how-we-work.html'){
			$('#accordian').animate({width: '550px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: '80px'}, {queue: false, duration: 800});
			$('.block').animate({width: "33px"}, { queue:false, duration: 800 });
			$('#how-we-work').animate({width: "410px"}, { queue:false, duration: 800});
			$('#images img, #home, #phone, #privacy').fadeOut(100);
			$('#images img#post-it-notes').delay(500).fadeIn(200);
			$('.bbq-content').hide();
			$('#how-we-work').find('.bbq-content').fadeIn(300);
			var url = $.param.fragment();
			$('#how-we-work').find( 'a.bbq-current' ).removeClass( 'bbq-current' );
			$('#how-we-work').find( '.bbq-content' ).children( ':visible' ).hide();
			url && $( 'a[href="#' + url + '"]' ).addClass( 'bbq-current' );
			if ( cache[ url ] ) {
			  cache[ url ].show();
			} else {
			  $('#how-we-work').find( '.bbq-loading' ).show();
			  cache[ url ] = $( '<div class="bbq-item"/>' )
				.appendTo( '#how-we-work .bbq-content' )
				.load( url, function(){
				  $( '#how-we-work .bbq-loading' ).hide();
				});
			}
		}
		
		if(window.location.hash == '#what-weve-done.html'){
			$('#accordian').animate({width: '550px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: '80px'}, {queue: false, duration: 800});
			$('.block').animate({width: "33px"}, { queue:false, duration: 800 });
			$('#what-weve-done').animate({width: "410px"}, { queue:false, duration: 800});
			$('#images img, #home, #phone, #privacy').fadeOut(100);
			$('#images img#notebooks').delay(500).fadeIn(200);
			$('.bbq-content').hide();
			$('#what-weve-done').find('.bbq-content').fadeIn(300);
			$('.sub-propelled').hide();
			$('.sub-past').hide();
			var url = $.param.fragment();
			$('#what-weve-done').find( 'a.bbq-current' ).removeClass( 'bbq-current' );
			$('#what-weve-done').find( '.bbq-content' ).children( ':visible' ).hide();
			url && $( 'a[href="#' + url + '"]' ).addClass( 'bbq-current' );
			if ( cache[ url ] ) {
			  cache[ url ].show();
			} else {
			  $('#what-weve-done').find( '.bbq-loading' ).show();
			  cache[ url ] = $( '<div class="bbq-item"/>' )
				.appendTo( '#what-weve-done .bbq-content' )
				.load( url, function(){
				  $( '#what-weve-done .bbq-loading' ).hide();
				});
			}
		}
		
		if(window.location.hash == '#what-we-do.html'){
			$('#accordian').animate({width: '550px'}, {queue: false, duration: 800});
			$('#red-propeller').animate({width: '80px'}, {queue: false, duration: 800});
			$('.block').animate({width: "33px"}, { queue:false, duration: 800 });
			$('#what-we-do').animate({width: "410px"}, { queue:false, duration: 800});
			$('#images img, #home, #phone, #privacy').fadeOut(100);
			$('#images img#bulb').delay(500).fadeIn(200);
			$('.bbq-content').hide();
			$('#what-we-do').find('.bbq-content').fadeIn(300);
			var url = $.param.fragment();
			$('#what-we-do').find( 'a.bbq-current' ).removeClass( 'bbq-current' );
			$('#what-we-do').find( '.bbq-content' ).children( ':visible' ).hide();
			url && $( 'a[href="#' + url + '"]' ).addClass( 'bbq-current' );
			if ( cache[ url ] ) {
			  cache[ url ].show();
			} else {
			  $('#what-we-do').find( '.bbq-loading' ).show();
			  cache[ url ] = $( '<div class="bbq-item"/>' )
				.appendTo( '#what-we-do .bbq-content' )
				.load( url, function(){
				  $( '#what-we-do .bbq-loading' ).hide();
				});
			}
		}
		
	})
  
	$(window).trigger( 'hashchange' );
	
  
});
