/*
	*************************************************************
			FUNÇÕES PARA FAZER PRELOAD AUTOMATICO DE IMAGENS
						
						(c)2005 TrevoWebDesign
	*************************************************************
*/

function replaceall(string,text,by) 
{
	var strLength = string.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) return string;

	var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0,txtLength))) return string;
	if (i == -1) return string;

	var newstr = string.substring(0,i) + by;

	if (i+txtLength < strLength)
		newstr += replaceall(string.substring(i+txtLength,strLength),text,by);

	return newstr;
}


function preload()
{
	imagens = new Array
	
	j=0;
	for (i=0; i < document.images.length; i++)
	{		
		if (document.images[i].onmouseover)
		{
			srcimagem = new String (document.images[i].onmouseover);
			imagens[j] = new Image();
			
			srcimagem = replaceall(srcimagem, "function onmouseover(event) {","");
			srcimagem = replaceall(srcimagem, "}","");
			srcimagem = replaceall(srcimagem, "this.src = ","");
			srcimagem = replaceall(srcimagem, ";","");
			srcimagem = replaceall(srcimagem, "\"","");
			
			imagens[j].src = srcimagem;
			j++;
		}
	}
}