function initInfoPopins() {
	$A(document.getElementsByTagName('a')).each(
			function(anchor) {
				if (anchor.rel && anchor.rel == 'infopopin') { anchor.onmouseover = function() { showInfoPopin(this); return false; }; }
			}
	);
}

function showInfoPopin(anchor) {
	anchor = $(anchor);
	var image = anchor.descendants().find( function(elem) { return (elem.tagName && elem.tagName.toLowerCase() == 'img'); } );
	var textToDisplay, anchorTitle = anchor.title ? anchor.title : '', imageAlt = image.alt ? image.alt : '';
	if (anchorTitle != '') {
		textToDisplay = anchorTitle;
	} else if (imageAlt != '') {
		textToDisplay = imageAlt;
	} else {
		return false;
	}

	var infoPopin = $('infopopin');
	if (!infoPopin) {
		infoPopin = document.createElement('div');
		infoPopin = $(infoPopin);
		infoPopin.id = 'infopopin';
		infoPopin.hide();
		document.body.appendChild(infoPopin);
	}

	image = $(image);
	var imageDimensions = image.getDimensions();
	var imagePosition = Position.cumulativeOffset(image);

	// infoPopin.style.position = 'absolute';
	infoPopin.innerHTML = textToDisplay;
	anchor.title = '';
	image.alt = '';

	Event.observe(anchor, 'mouseout',
			function() {
				if ($('infopopin')) $('infopopin').hide();
				if (anchorTitle != '') anchor.title = anchorTitle;
				if (imageAlt != '') image.alt = imageAlt;
			}
	);

	if (!infoPopin.visible()) infoPopin.show();
	var infoPopinDimensions = infoPopin.getDimensions();
	infoPopin.style.left = (parseInt(imagePosition[0]) - infoPopinDimensions.width + imageDimensions.width + 3) + 'px';
	infoPopin.style.top = (parseInt(imagePosition[1]) - infoPopinDimensions.height - 3) + 'px';
}
