/* momentum.js - Handles hover popup for momentum report */

YAHOO.ballhype.opened = {};
YAHOO.ballhype.active = {};
function hideHovers() {
	for (var hoverId in YAHOO.ballhype.opened) {
		if (YAHOO.ballhype.opened[hoverId] && !YAHOO.ballhype.active[hoverId]) {
			showHide(hoverId, false);
			YAHOO.ballhype.opened[hoverId] = false;
		}
	}
}
function showHover(e) {
	var target = YAHOO.util.Event.getTarget(e);
	if (!target.id) {
		target = target.parentNode;
		if (!target.id) {
			target = target.parentNode;
		}
	}
	if (target.id) {
		var hoverId = 'hover.' + target.id.split('.')[1];
		showHide(hoverId, true);
		if (!YAHOO.ballhype.opened[hoverId]) {
			var imageId = 'thumb.' + target.id.split('.')[1];
			var pos = YAHOO.util.Dom.getXY(imageId)
			YAHOO.util.Dom.setXY(hoverId, [pos[0] + 33, pos[1]]);
		}
		YAHOO.ballhype.opened[hoverId] = true;
		for (var otherId in YAHOO.ballhype.active) {
			if (hoverId != otherId && YAHOO.ballhype.opened[otherId]) {
				showHide(otherId, false);
				YAHOO.ballhype.opened[otherId] = false;
			}
		}
		YAHOO.ballhype.active[hoverId] = true;
	}
}
function hideHover(e) {
	var target = YAHOO.util.Event.getTarget(e);
	if (target.id) {
		var hoverId = 'hover.' + target.id.split('.')[1];
		YAHOO.ballhype.active[hoverId] = false;
		var t = setTimeout("hideHovers()",500);
	}
}
