/**
 * On load this finds all AREA tags (used in image map)
 * and assigns mouseover event that triggers a show/hide
 * of office locations. AREA tags are given ids like "swindon"
 * and the DIVS containing the addresses are labelled "swindon-box"
 *
 */
jQuery(document).ready(function() 
{
	$("area", document.body).each(
		function()
		{
			$(this).mouseover(
				function(e)
				{
					show_office ($(this).attr("id"));
				}
			)
		}
	)
	
	function show_office(id)
	{
		$("area", document.body).each(
			function()
			{
				var box_id = $(this).attr("id") + "-box";

				// show
				if ($(this).attr("id") == id)
				{
					$("#"+box_id).css("display", "inline");
					$("#"+box_id).css('opacity','0').show();
					$("#"+box_id).fadeTo("slow", 0.95);
					
				}
				// hide
				else
				{
					//$("#"+box_id).css("display", "none");
					$("#"+box_id).fadeTo("slow", 0, function()
						{
							$("#"+box_id).css("display", "none");
						}
					);
				}
			}
		)
	}
});
