//Custom Font: replace HTML text with GIF images (dependent on common.js getElementsByClass();)

function textToGif(textObject, font){
	var newHTML = '';
	var content = textObject.innerHTML;
	
	//content=content.toUpperCase();
	for (var i=0;i<content.length;i++){
		
		//If HTML tag found, don't convert!
		if (content.charAt(i) == '<'){
			while (content.charAt(i) != '>'){
				newHTML = newHTML + content.charAt(i);
				i++;
			}
			newHTML = newHTML + content.charAt(i);
		}
		//If character found, convert to GIF
		else{	
		  newHTML = newHTML + "<span><img src='http://img.metaboli.fr/common/V4/customFont/" + font + "/" + content.charCodeAt(i) + ".gif' border='0' onError='this.parentNode.innerHTML=this.alt' alt='" + content.charAt(i) + "' title=''></span>";
		  newHTML = newHTML + "<span><img src='http://img.metaboli.fr/common/V4/customFont/" + font + "/space.gif' border='0' alt='' title='' onError='this.parentNode.innerHTML=this.alt'></span>";
		}
	}
	textObject.innerHTML = newHTML;
}

function fontReplace(font){
	var classElements = new Array();
	
	classElements = getElementsByClass(font);
	
	for(var i=0; i<classElements.length; i++)
		textToGif(classElements[i], font);
}

