/******************************************************************************
 * Global functions for Blue Olive.
 * jQuery framework is required.
 * 
 * Author: Neal Krouse (krousen@comcast.net)
 *
 * NOTES:
 * 16 Feb 2008
 * Started source code
 *
 ******************************************************************************/

$(document).ready(function(){
	// add email icon only if external URLs are present
	$("#primary a[@href^='http']").addClass("external");

	/* Prep the show and hide of position details */
	
	// First, wrap div.details inside a new div, then create and append p.toggle
	$("#primary div.details").hide().wrap("<div><\/div>").after("<p class=\"toggle\">View Menu<\/p>"); 
	// Second, attach onclick behavior to p.toggle that shows/hides div.details
	$("#primary p.toggle")
		.toggle(
			function(){ 
				$(this).siblings().slideDown("slow");
				$(this).text("Hide Menu"); 
				$(this).addClass("expand");
			},
			function(){ 
				$(this).siblings().slideUp("slow");
				$(this).text("View Menu");
				$(this).removeClass("expand");
			}
		)
		.hover(
			function(){$(this).addClass("over")},
			function(){$(this).removeClass("over")}
		);
	// remove the back to top links
	$("#primary p.goToTop").remove();
	
	//gallery
	var a = $("#gallery_page #branding li a");
	a.eq(0).addClass("current");
	a.each(function(){
		$(this).click(function(){
			var this_href = $(this).attr("href");
			$("#pic").fadeOut("slow", function(){$("#pic").load(this_href)}).fadeIn("slow");
			a.removeClass("current");
			$(this).addClass("current");
			return false;
		});
	});

	
})