// FUNCTIONS

toggleBlocks = function(el) {

	var speed = "fast";
	
	var s = $(el).attr("class");
	s = s.replace(" link", "");
	s = s.replace(" over", "");

	var div = $(el).parent().next().find("div." + s);
	
	if (div.is(':visible') == true) {
		div.slideUp(speed);
		return;
		}

	var count = 0;
		
	$("table.consultants").find("div.detail, div.contact").each ( function ()
		{
			if ( $(this).is(":visible") )
			{
				count = count + 1;
				$(this).slideUp(speed, function()
					{
						div.slideDown(speed);
					}
				);
			}
		}
	);
	
	if ( count == 0 )
	{
		div.slideDown(speed);
	}
	
}

// jQuery Init
$(document).ready(function()
	{
		$("div.detail, div.contact").css("display","none");
		
		$("td.link").click(function(){
			toggleBlocks(this);
			});

		$("td.link").hover(function(){
		  $(this).addClass("over");
		},function(){
		  $(this).removeClass("over");
		});
	}
);
