$(document).ready(function() {
	$("#nav li > ul").wrapList({ itemsPerColumn: 7 });
	$('#nav li > ul').hide();
	$('#nav li:has(ul)').find('a:first').append(' &raquo;');
	$("#nav li").hoverIntent({
				sensitivity: 3, 
				interval: 200, 
				over: makeTall, 
				timeout: 500, 
				out: makeShort
			});
	function makeTall() {$('> ul', this).slideDown('fast');}
	function makeShort() {$('> ul', this).hide();}
	$('#summary #summary-text').hide();
    $('#summary').hoverIntent(
		function() { 
			$('#summary-text').show('medium');
			$('#splash img.splash').animate({opacity: .4}, 'medium');
			$('#splash h2').animate({paddingRight: '12px'}, 'fast');
			$('#splash h2 span').fadeOut('fast');
		},
		function() {
			$('#summary-text', this).hide('medium');
			$('#splash img.splash').animate({opacity: 1}, 'medium');
			$('#splash h2').animate({paddingRight: '24px'}, 'fast');
			$('#splash h2 span').fadeIn('fast');
		}
	);
	$('A[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
	$("div.entry").click(function(){
		window.location=$(this).find("a").attr("href"); return false;
	});
	$(".sideBar #related ").click(function(){
		window.location=$(this).find("a").attr("href"); return false;
	});
	$("#content-main div.entry:first").addClass("first");
});
var currentimageTab = 0; 

function openimageTab(clickedimageTab) {
    var thisimageTab = $("ul.project-gallery-nav a").index(clickedimageTab);
    $("ul.project-gallery-nav li a").removeClass("active");
    $("ul.project-gallery-nav li a:eq("+thisimageTab+")").addClass("active");
    $("div.project-gallery-image").fadeOut();
    $("div.project-gallery-image:eq("+thisimageTab+")").fadeIn();
    currentimageTab = thisimageTab;
}
function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}
$(document).ready(function() {
    equalHeight($("#sitemap #content-main ul > li").not("ul li ul li"));
    equalHeight($("#highlights > li").not("#highlights li ul li"));
});

$(document).ready(function() {
    $("ul.project-gallery-nav li a").click(function() {
        openimageTab($(this)); return false;
    });

    $("ul.project-gallery-nav li a:eq("+currentimageTab+")").click();
    $.superbox();

});
