/**
 * Replaces content of all the Tags with ID='ir-X' with image at 'images/X.png'
 */
function replaceTitles()
{
	// Check for DOM support
	if (!(document && document.implementation && document.implementation.hasFeature))	return;

	// Check for image support
	if (!document.images)	return;
	
	var pattern = new RegExp('ir-\w?');
	var els = document.getElementsByTagName('*');
	var elsLen = els.length;
	var tags = new Array();	

	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].id) ) {
			tags[j] = els[i];
			j++;
		}
	}	

	for (var i = 0; i < tags.length; i++)	{
		if (tags[i].id) {
			var image = document.createElement('img');
			image.src = 'images/' + tags[i].id.replace('ir-','') + '.png';
			image.alt = tags[i].firstChild.nodeValue;
			image.title = tags[i].firstChild.nodeValue;
			tags[i].replaceChild(image,tags[i].firstChild);
		}
	}
}

