azure.staff = 
{
	
	loading_content : false,
	current_instigator : false,
	target_div : false,

	bind_buttons : function()
	{
		$(".load_staff").live("click", function()
		{
			if (azure.staff.loading_content == true)
				return false;

			azure.staff.target_div = $("#" + $(this).attr("rel"));
			azure.staff.current_instigator = $(this);
			azure.staff.loading_content = true;
			
			data_source = $(this).attr("href");

			azure.staff.target_div.fadeOut(666, function()
			{
				$.post(data_source, {}, azure.staff.handle_load);				
			});
			
			return false;
		});
		
		$(".toggle-staff-details").live("click", function()
		{
			if (azure.staff.loading_content == true)
				return false;
				
			azure.staff.loading_content = true;
			flash_top = $(".staff-slider-inner").eq(0).css("top");
			if (flash_top != "-370px")
			{
				//hide flash
				$(".staff-slider-inner").animate( { top: "-370px" }, 666, function() { azure.staff.loading_content = false; });
			}
			else
			{
				//show flash
				$(".staff-slider-inner").animate( { top: "0px" }, 666, function() { azure.staff.loading_content = false; });
			}
			
			return false;
		});
		
	},
	
	handle_load : function(data)
	{
		azure.staff.target_div.html(data);
		
		/*azure.staff.current_instigator
			.parents("div")
			.eq(0)
			.find(".active")
			.eq(0)
			.removeClass("active");

		azure.staff.current_instigator.addClass("active");*/
		
		Cufon.replace(".staff-slider .delay-replace");	
		
		azure.staff.loading_content = false;	
		azure.staff.target_div.fadeIn(666, function()
		{
			flash_loc = $("#staff-swf-location").val();
			if (flash_loc != "")
				swfobject.embedSWF($("#staff-swf-location").val(), "staff-slider-flash-inner-movie", "429", "286", "8.0.0", false, { }, { menu:"false", wmode: "transparent" } );
		});
	}
	
}

$(function() 
{
	azure.staff.bind_buttons();
	Cufon.replace(".staff-slider .delay-replace");
});