var toolTips = new Array();

// This function closes all opened tooltips. The id identified an tooltip no closable.
function closeAllToolTips(id) {
	var element = get(id);
	for (var i = 0; i < toolTips.length; i++) {
		if (element == null || element.id != toolTips[i].id)  
		hideToolTip(toolTips[i].id);
	}
}

// Add one tooltip to an array of tooltips.
function addToolTip(toolTip) {
	toolTips.push(toolTip);
}

// Remove one tooltip (indicated by toolTip) of the array of tooltips.
function removeToolTip(toolTip) {
	var index = -1;
	for (var i = 0; i < toolTips.length; i++) {
		if (toolTips[i].id == toolTip.id) index = i;
	}
	if (index != -1) toolTips.splice(index,1);
}

// Function to hide the tooltip.
function hideToolTip(id) {
	var element = get(id);
	element.style.display = "none";
	removeToolTip(element);
}

// Function to show the tooltip.
function showToolTip(id, event) {
	var element = get(id);
	element.style.display = "block";
	addToolTip(element);
	stop(event);
}

// Function to show/hide the tooltip depending on his state.
function showHideToolTip(id, event) {
	var element = get(id);
	if (element.style.display == "block")
		hideToolTip(id);
	else 
		showToolTip(id,event);		
}