/*
 * contentMenu2.1 - ajax content loader
 *
 * Copyright (c) 2008 Steve Gibbs
 *
 * $Date: 2008-11-08 12:50:31
 */

$(document).ready(function(){
	//References
	var sections = $("#menu li");
	var loading = $("#loading");
	var content = $("#contentajax");
	
	//Manage click events
	sections.click(function(){
		//show the loading bar
		showLoading();
		//load selected section
		switch(this.id){
			case "zelinski":
				content.slideUp();
				content.load("biographies/biographies.html #zelinski_biography", hideLoading);
				content.slideDown();
				break;
			case "howland":
				content.slideUp();
				content.load("biographies/biographies.html #howland_biography", hideLoading);
				content.slideDown();
				break;
			case "krigel":
				content.slideUp();
				content.load("biographies/biographies.html #krigel_biography", hideLoading);
				content.slideDown();
				break;
			//case "external":
				//content.slideUp();
				//content.load("biographies/external.html", hideLoading);
				//content.slideDown();
				//break;
			default:
				//hide loading bar if there is no selected section
				hideLoading();
				break;
		}
	});

	//show loading thingamajiggy
	function showLoading(){
		loading
			.css({visibility:"visible"})
			.css({opacity:"1"})
			.css({display:"block"})
		;
	}
	//hide loading bar
	function hideLoading(){
		loading.fadeTo(1000, 0);
	};
});
