$(document).ready(function(){
	
	var path = location.pathname;   
    $("#subnav a[href='" + [ path ] + "']").parent("li").each(function() { 
        $(this).addClass("current");
    });

	$("#galnav a[href='" + [ path ] + "']").each(function() {
        $(this).addClass("current");
    });
	
	$('#nav li').hover(
		function() {$(this).children().show();},
		function() {$('ul', this).hide('fast');}
	);
	
	//open offsite links in new window 
	$('a[href^="http://"]').attr("target", "_blank");
	
	//highlight anchors
	function highlight(elemId){
	    var elem = $(elemId);
	    elem.css("backgroundColor", "#ffffff"); // hack for Safari
	    elem.animate({ backgroundColor: '#f2f9d8' }, 1500);
	    setTimeout(function(){$(elemId).animate({ backgroundColor: "#ffffff" }, 3000)},1000);
	}
	if (document.location.hash) {
	    highlight(document.location.hash);
	}

	$('a[href^="#"]').click(function(){
	    var elemId = '#' + $(this).attr('href').split('#')[1];
	    highlight(elemId);
	});
	
	//slideshow
	$('#slideshow').slides({
		preload: true,
		preloadImage: '/img/ssloading.gif',
		effect: 'fade',
		crossfade: true,
		fadeSpeed: 500,
		play: 7000,
		pause: 5000,
		hoverPause: true
	});
	
});


