//console = loadFirebugConsole();

var tooltip = null;

function show_tooltip(ev) {
		ev = new Event(ev);
		var pos = this.getCoordinates();
		tooltip.setStyles({
						'display':'block',
						'left':pos.left + pos.width + 5, 'top':pos.top - 90
								});
		tooltip.fx.stop();
		tooltip.fx.start({'opacity':1});
		tooltip.setHTML(this.description+"<p class=\"more\">Cliquer pour plus d'info</p>");
}

function hide_tooltip(ev) {
		tooltip.fx.stop();
		tooltip.fx.start({'opacity':0});
}

function init_prestations_tooltips () {
		function _install_handler(a) {
				a.description = a.title;
				a.title = "";
				a.addEvent("mouseover", show_tooltip);
				a.addEvent("mouseout", hide_tooltip);
		}
		$$("A.prestation-title").each(_install_handler);
		tooltip = new Element("div", {'id':'prestation-tooltip'});
		tooltip.injectInside(document.body);
		tooltip.fx = tooltip.effects({'fps':10});
		tooltip.fx.set(0);
}

window.addEvent("domready", init_prestations_tooltips);

