$(function() {

	$("#blog_nav").bind("mouseenter", function() {
	
		$("#tumblr_span").show();
	
	}).bind("mouseleave", function () {
	
		$("#tumblr_span").hide();	
	
	});
	
	if ($.browser.msie && $.browser.version <= 6 ) {
	
		$("#ie6_notice").show();
		
	}	

	scroll(0,0);

	if ($("#grow_box_button")) {
	
		$("#grow_box_button").css("cursor","pointer").click(function () {PES.grow_box();});
	
	}
	
	if ($("#pageholder").height() < $("html").height()) 
	{	
		$("#pageholder").css("height", "100%");
	} 

	// Opacity
 	$("#navigation").css("opacity", ".9"); 

	// Make the divs in the nav go the same way as the contained links
	$("ul.sub_nav > li").click(function() {
	
		var location = $(this).children("a").attr("href");
		
		window.location.href = location;
	
	});
	
	// Stripe the navigation items
	$("ul.sub_nav").each(function() {
	
		$(this).find("li:odd").addClass("striped");
	
	}).hide();
	
	$("ul.sub_nav li:last").css("border-bottom", "");
	
	$("#navigation > li").bind("mouseenter",function() {
	
		$(this).children("div").children("span.small_note").show();

		var child_ul = $(this).children("ul:first");
		
		if (!child_ul.is(":animated")) child_ul.slideDown("fast");
		
	}).bind("mouseleave", function() {
	
		$(this).children("div").children("span.small_note").hide();
		
		$(this).children("ul:first").slideUp("fast");
	
	}).click(function () {
	
		$(this).children("div").children("span.small_note").hide();
		
		$(this).children("ul:first").slideUp("fast");
	});
  
	
	$("#navigation > li").hover(
	    function() {$(this).addClass("hovered_category");},
		function() {$(this).removeClass("hovered_category");}
	);
	
	$("ul.sub_nav > li").hover(
		function () {$(this).addClass("hovered_item");},
		function () {$(this).removeClass("hovered_item");}
	);
	
	$("div.portfolio_item").hover(
		function () {$(this).addClass("portfolio_item_highlight")},
		function () {$(this).removeClass("portfolio_item_highlight")}
	);
	
		
});

var PES = {

	grown: false,

	grow_box: function () {
	
		if (this.grown) {
		
			scroll(0, 0);
			
			$("html").css("overflow-y", "hidden");
			$("#content_space").css("height", "500px");
			$("#content_frame").css("height", this.frame_size);
		
		} else {
		
			var frame = $("#content_frame");
		
			this.frame_size = frame.css("height");
		
			$("html").css("overflow-y", "scroll");
			$("#content_space").css("height", "auto");

			frame.animate({height: "1000px"});
		
		}
		
		this.grown = !this.grown;
	}
}