	$(document).ready(function(){
		
		// li:hover Fix and fade/delay function
		$("ul#nav").superfish({ 
            pathClass:  'current' 
        }); 
        
		// Keeps the nav li the same height
		var $nav = $("#nav .sameHeight").equalizeCols();
		$(document).bind("fontresize", function () {
			$nav.equalizeCols();
		});

		// Keeps product boxes the same height
		var $addBox = $(".prodBox").equalizeCols();
		$(document).bind("fontresize", function () {
			$addBox.equalizeCols();
		});

		// Keeps product box divs the same height
		// var $addBox = $(".prodBox div").equalizeCols();
		// $(document).bind("fontresize", function () {
		// 	$addBox.equalizeCols();
		// });

		// Keeps sitemap ul the same height
		var $addBox = $(".sitemap ul").equalizeCols();
		$(document).bind("fontresize", function () {
			$addBox.equalizeCols();
		});
		
		// accordion
		
			// hide all accordion info
	  		$("div.accordionContent").hide();
	  		
	  		// add 'click to open' tooltip
	  		$("div.accordion").append('<span class="actip">Click to open</span>');
	  		
	  		// on hover
			$("div.accordion").hover(function () {
	    		$(this).addClass("hoverIt");
			}, function () {
	    		$(this).removeClass("hoverIt");
	  		});
	  		
	  		// reveal text
	  		$("div.accordion").click( function() {
			
		  		$("div.accordionContent").slideUp("slow"); // hide any currently active
		  		$("div.accordion").removeClass("ac-active");
		  		
		  		$('span.actip').html("Click to open"); // set tooltips
		  			
		  		// if current clicked text area is hidden show it
		  		if ($(this).children("div").is(":hidden")) {
		  			$(this).children("div").slideDown("slow"); // show clicked	
		  			$(this).addClass("ac-active"); // set active class
		  			$('span.actip', this).html("Click to close");
		  		}
	  			
	  			return false;
	  		});
	  		
	  	// portfolio accordion
		
			// hide all accordion info
	  		$("div.portfolio-accordion p").hide();
	  		
	  		// add 'click to open' tooltip
	  		$("div.portfolio-accordion").append('<span class="actip"> Click to open</span>');
	  		
	  		// on hover
			$("div.portfolio-accordion").hover(function () {
	    		$(this).addClass("pa-hover");
			}, function () {
	    		$(this).removeClass("pa-hover");
	  		});
	  		
	  		// reveal text
	  		$("div.portfolio-accordion").click( function() {
			
		  		$("div.portfolio-accordion p").slideUp("slow"); // hide any currently active
		  		$("div.portfolio-accordion").removeClass("pro-active");
		  		
		  		$('span.actip').html("Click to open"); // set tooltips
		  			
		  		// if current clicked text area is hidden show it
		  		if ($(this).children("p").is(":hidden")) {
		  			$(this).children("p").slideDown("slow"); // show clicked	
		  			$(this).addClass("pro-active"); // set active class
		  			$('span.actip', this).html("Click to close");
		  		}
	  			
	  			return false;
	  		});
	  		
	  	// portfolio tabs 1
	  	
	  		// give first nav item link selected state
			$("ul#ppNav li:first a").addClass("selectedNav");
			
			// hide all but first breakdown & hide all headers
			$("div.ppIntro:not(:first)").hide();
			$("div.ppIntro h2").hide();
			
			// remove nav margin
			$("ul#ppNav").css("margin-bottom", "0");
			
			// disable outline focus on tabs
			$("ul#ppNav li a").css("outline", "0");
			
			// click a new tab
			$("ul#ppNav li a").click( function() {
				
				// remove all selected classes & add new selected
				$("ul#ppNav li a").removeClass("selectedNav");
				$(this).addClass("selectedNav");
				
				// get anchor of clicked link & create div ref
				var divRef= $(this).attr("href");
				divRef = "div" + divRef;
				
				// hide all breakdowns and show clicked one
				$("div.ppIntro").hide();
				$(divRef).show();
				
				return false;
			});
			
		// portfolio tabs 2
	  	
	  		// give first nav item link selected state
			$("ul#projectNav li:first a").addClass("selectedNav");
			
			// hide all but first breakdown & hide all headers
			$("div.project:not(:first)").hide();
			
			// remove nav margin
			$("ul#projectNav").css("margin-bottom", "0");
			
			// disable outline focus on tabs
			$("ul#projectNav li a").css("outline", "0");
			
			// click a new tab
			$("ul#projectNav li a").click( function() {
				
				// remove all selected classes & add new selected
				$("ul#projectNav li a").removeClass("selectedNav");
				$(this).addClass("selectedNav");
				
				// get anchor of clicked link & create div ref
				var divRef= $(this).attr("href");
				divRef = "div" + divRef;
				
				// hide all breakdowns and show clicked one
				$("div.project").hide();
				$(divRef).show();
				
				return false;
			});
		
		// project sub
			
			$("div#project-sub ul li").hover(function () {
	    		$(this).addClass("proHover");
			}, function () {
	    		$(this).removeClass("proHover");
	  		});
	  		
	  		// make entire li clickable
			$("div#project-sub ul li").click(function() {
  				window.location = ($("a:first", this).attr("href"));
			});

	});


$(window).load(function() {
    $('.projectImage').nivoSlider({
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
        animSpeed: 500, // Slide transition speed
        pauseTime: 5000, // How long each slide will show
        directionNav: true, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: false, // 1,2,3... navigation
        keyboardNav: false, // Use left & right arrows
        pauseOnHover: true, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next' // Next directionNav text
    });
    
    // portfolio, set height of project overviews
	  		
	  		if ($("div.project-info").length > 0){
	  			
	  			var tallestDiv = 0;
				
				$("div.project-info").each(function() {
					
					if ($(this).height() > tallestDiv) {
						tallestDiv = $(this).height();
					}
					
				});
				
				//tallestDiv = tallestDiv - 60;
				
				$("div.project-info").css("height", tallestDiv);
    				
	  		}
});
