var hoverDiv = false;
var infoInterval = null;
var intervalSetBy = "";

function find() {
	if (document.links) {
		for (i = 0; i < document.links.length; i++) {
			if (document.links[i].className == 'pic' || document.links[i].className == 'selected') {
				document.links[i].onmouseover = new Function("showInformation(this, '" + i + "')");
				document.links[i].onmouseout  = new Function("startInterval('" + i + "')");
			}
		}
	}
}

function getTitle(ele) {
	for (i = 0; i < ele.attributes.length; i++) {
		if (ele.attributes[i].nodeName == 'alt') {
			return ele.attributes[i].nodeValue;
		}
	}
	return "";
}

function showInformation(ele, attrId) {
	clearInterval(infoInterval);
	intervalSetBy = attrId;
	
	var x = ele.offsetLeft;
	var y = ele.offsetTop;
	
	var parent = ele;
	while (parent.offsetParent)
	{
		parent = parent.offsetParent;
		x += parent.offsetLeft;
		y += parent.offsetTop;
	}
	
	x += (isIE ? 0 : 2);
	y -= (isIE ? 18 : 92);
	
	if (!hoverDiv) {
		hoverDiv = document.createElement('div');
		hoverDiv.setAttribute('id', 'hoverdiv');
		hoverDiv.style.position		   = 'absolute';
		hoverDiv.style.backgroundColor = 'white';
		hoverDiv.style.color 		   = 'black';
		hoverDiv.style.padding     	   = '2px';
		
		value = 8.0;
		hoverDiv.style.opacity = value/10;
		if (isIE) {
			hoverDiv.style.filter = 'alpha(opacity=' + value*10 + ')';
		}
		
		document.body.appendChild(hoverDiv);
	}
		
	hoverDiv.style.display = '';
	hoverDiv.onmouseover = new Function("hoverDiv.style.display = 'none';");
	hoverDiv.style.left = x + 'px';
	hoverDiv.style.top = y + 'px';
	
	hoverDiv.innerHTML = getTitle(ele);
}

function startInterval(attrId) {
	infoInterval = setInterval("stopInterval('" + attrId + "')", 1000);
}

function stopInterval(attrId) {
	if (intervalSetBy == attrId) {
		clearInterval(infoInterval);
	
		if (hoverDiv) {
			hoverDiv.style.display = 'none';
		}
	}
}
