
$(window).load(function() {

	// add classes to the first three posts on the homepage
	$("div.post:nth-child(1)").addClass("greenbox");
	$("div.post:nth-child(2)").addClass("brownbox");
	$("div.post:nth-child(3)").addClass("greenbox");
	
	//set up classes on the navigation li's
	$("li.page_item").children("ul").children("li.page_item").removeClass("page_item");
	$("li.page_item").children("ul").children("li").addClass("childnav");
	
	$("li.page_item > a").click(function() {
	
		//select it's direct sub ul
		var subnav = $(this).next();
		//other subnavs
		var navsibling = $(this).parent().siblings('li').children('ul');
		
		//hide siblings subnav
		if (navsibling.is(":open")) {
			navsibling.slideUp("slow");
		}
		
		// check to see if sub is hidden, open if it is, close if it isn't
		if (subnav.is(":hidden")) {
			subnav.slideDown("slow");
		} else {
			subnav.slideUp("slow");
		}		
		
		// stop the top level link from linking
		return false;		
		
	});
	
	$("li.childnav a").click(function(){
		return true;
	});
	
});
