Cufon.replace('h1.light',{fontFamily:'GillLight'});
Cufon.replace('h2.light',{fontFamily:'GillLight'});
Cufon.replace('h3.light',{fontFamily:'GillLight'});
Cufon.replace('h1.strong',{fontFamily:'GillNormal'});
Cufon.replace('h2.strong',{fontFamily:'GillNormal'});
Cufon.replace('h3.strong',{fontFamily:'GillNormal'});

$(document).ready(function(){
	// Attach sharethis handler to share button
	var object = SHARETHIS.addEntry({
	title:'',
	summary: ''},
	{button:false});
	//Tie customized button to ShareThis button functionality.
	var element = document.getElementById("sharethis");
	object.attachButton(element);

	// PNG fix for IE, works with CSS bg too (partly)
	$(document).pngFix();

	// add smooth scroll
	$('.parselinks').each(function() {$(this).localScroll();} );

	// remove link background images since we're re-doing the hover interaction below 
	// (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
	// we also want to only remove the image on non-selected nav items, so this is a bit more complicated
	$(".nav").children("li").each(function() {
		var current = "nav current-" + ($(this).attr("class"));
		var parentClass = $(".nav").attr("class");
	});	

	// create events for each nav item
	attachNavEvents(".nav", "nhome");
	attachNavEvents(".nav", "ngames");
	attachNavEvents(".nav", "nigames");
	attachNavEvents(".nav", "nblog");
	attachNavEvents(".nav", "nmerch");
	attachNavEvents(".nav", "nabout");
	attachNavEvents(".nav", "ncontact");
	
	function attachNavEvents(parent, myClass) {
		$(parent + " ." + myClass).mouseover(function() {
			$(this).append('<div class="nav-' + myClass + '"></div>');
			$("div.nav-" + myClass).css({display:"none"}).fadeIn(200);
		}).mouseout(function() {
			$("div.nav-" + myClass).fadeOut(200, function() {$(this).remove();});
		});
	}
});
