/* js for auto-vorbeck team page */

var bubbleOffsetX = -90;
var bubbleOffsetY = -140;

function initTeamDisplay() {
	// add event handlers to image map
	$("area").bind("mouseover", showDetails);
	$("area").bind("mouseout", hideDetails);
	$("area").bind("click", function(){return false});
}

function showDetails(event) {
	var area = $(event.target);
	var coords = area.attr("coords").split(",");
	var detailBubble = $("#team-detail");
	// fill bubble
	var personData = area.attr("alt").split("|");
	$("#team-detail-name").text(personData[0]);
	$("#team-detail-position").text(personData[1]);
	$("#team-detail-contact").html(personData[2] + "<br/>" + personData[3]);
	$("#team-detail-image").attr("src", "images/team/" + area.attr("id") + ".jpg");

	// position bubble
	detailBubble.css("top", (parseInt(coords[1]) + bubbleOffsetY) + "px");
	detailBubble.css("left", (parseInt(coords[2]) + bubbleOffsetX) + "px");
	detailBubble.fadeIn("fast");

}

function hideDetails(event) {
	$("#team-detail").hide();
} 

$(document).ready(function(){
  initTeamDisplay();
});
