/* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. This script requires jQuery to work. Download jQuery at www.jquery.com */
function fademenu(el){if(!$("#navigation #"+el).hasClass("active")){$("#navigation #"+el+" a").clone().removeAttr("id").attr("id",el+"-hover").hide().appendTo("#navigation #"+el);
$("#navigation #"+el).bind("mouseenter",function(){$("#"+el+" a:last-child").fadeIn("slow");})
$("#navigation #"+el).bind("mouseleave",function(){$("#"+el+" a:last-child").fadeOut("slow");})}};
$(function(){$("pre").each(function(){var type = this.getAttribute("class");$("<span class='code-type'>"+type+"</span>").prependTo(this);});});
$(function(){
// IE6 support :hover
$("form input.submit").bind("mouseenter",function(){$(this).addClass("hover");
// over
});
$("form input.submit").bind("mouseleave",function(){$(this).removeClass("hover");
// leave
});})
// Load Nav
$(function(){
$("body").addClass("JS");
fademenu("home");
fademenu("services");
fademenu("portfolio");
fademenu("about");
fademenu("blog");
fademenu("contact");
});

var Header = {
	// Let's write in JSON to make it more modular
	addFade : function(selector){
		$("<span class=\"fake-hover\"></span>").css("display", "none").prependTo($(selector)); 
		// Safari dislikes hide() for some reason
		$(selector+" a").bind("mouseenter",function(){
			$(selector+" .fake-hover").fadeIn("slow");
		});
		$(selector+" a").bind("mouseleave",function(){
			$(selector+" .fake-hover").fadeOut("slow");
		});
		
	}
};

$(function(){
	Header.addFade("#header");
});