//     =============================================
//
//     POP OVER TOOLTIPS FOR IMAGES
//     ---------------------------------------------
//
//     By Chris Hill-Scott, except where noted.
//
//     Code is public domain, reuse as desired.
//
//     Requires jQuery
//
//     ---------------------------------------------
//
//     TODO:
//
//     =============================================

jQuery.fn.annotate = function() {

	// Behave well, return the jQuery object
	return this.each(

		function() {

			var $img = $(this),
				$tooltip = $img.siblings("div");

			if ($tooltip.is(":hidden")) {

				$tooltip
					.css("top", $img.position().top)
					.fadeIn(300);

				_gaq.push(["_trackEvent", "tooltip", "open", $img.attr("alt")]);

			} else {

				$tooltip
					.fadeOut(200);

				_gaq.push(["_trackEvent", "tooltip", "close", $img.attr("alt")]);

			}

			return false;

		}
	);

}
