// 
// Copyright Somers Technology and Bob Somers 2009
// www.somerstechnology.com
//

var selected = null;
var resizeAnimTime = 750;
var fadeTime = 500;

$(document).ready(function()
{
	$("h3").click(function()
	{
		if (selected == null)
		{
			resizeNav();
			selected = $(this).text();
			setTimeout(function()
			{
				$("#" + selected + "_content").fadeIn(fadeTime);
			}, resizeAnimTime * 1.5);
		}
		else if (selected == $(this).text())
		{
			return;
		}
		else
		{
			$("#" + selected + "_content").fadeOut(fadeTime);
			selected = $(this).text();
			$("#" + selected + "_content").fadeIn(fadeTime);
			
		}
		
	});
	
	$("h3").mouseover(function()
	{
		$(this).addClass("over");
	});
	
	$("h3").mouseout(function()
	{
		$(this).removeClass("over");
	});
});

function resizeNav()
{
	$("#who").animate({width: "125px"}, {queue: false, duration: resizeAnimTime})
			   .animate({marginLeft: "15px"}, resizeAnimTime)
			   .animate({marginTop: "-180px"}, resizeAnimTime);
	
	$("#what").animate({width: "125px"}, {queue: false, duration: resizeAnimTime})
				.animate({marginLeft: "155px"}, resizeAnimTime)
				.animate({marginTop: "-180px"}, resizeAnimTime);
	
	$("#contact").animate({width: "198px"}, {queue: false, duration: resizeAnimTime})
				   .animate({marginLeft: "295px"}, resizeAnimTime)
				   .animate({marginTop: "-180px"}, resizeAnimTime);
}