$(document).ready(function(){
	panelShow();
	changeWidth();
	navFade();
	footfade();
});

function panelShow() {
	$('.latest-post-wrap').hover(function(){  
        $(".latest-content", this).stop().animate({top:'0px'},{queue:false,duration:300});  
    }, function() {  
        $(".latest-content", this).stop().animate({top:'117px'},{queue:false,duration:300});  
    });  
}

function changeWidth() {
	$("#textExpand a").click(function(){
	  $("#page-wrap").animate({"max-width": "600px"},"slow");

	  $("#textExpand").hide();
	  $("#textContract").show();
	}); 
	$("#textContract a").click(function(){
	  $("#page-wrap").animate({"max-width": "960px"},"slow");

	  $("#textContract").hide();
	  $("#textExpand").show();
	}); 
}

function navFade() { 
	$("#nav a").mouseover(function(){
	  $(this).stop().animate({"opacity": "1"}, "fast");
	  
	});
   $("#nav a").mouseleave(function(){
	  $(this).stop().animate({"opacity": "1"}, "fast");
	});
}

function lightSwitch(){
	$("#lightSwitchOn").click(function(){
		$("body").css("background","url(http://www.leighhowells.com/wp-content/themes/2012/images/backgroundColourOn.jpg) top center fixed no-repeat");
		$("#lightSwitchOn").hide();
	    $("#lightSwitchOff").show();
	});
	$("#lightSwitchOff").click(function(){
		$("body").css("background","url(http://www.leighhowells.com/wp-content/themes/2012/images/backgroundColour1.jpg) top center fixed no-repeat");
		$("#lightSwitchOn").show();
	    $("#lightSwitchOff").hide();
	});
	
}

function footfade(){
	$('#footer').waypoint(function() {
	   alert('You have scrolled to an entry.');
	});
}
