// eduardo : 06/11/2003

// finalidade: o nome diz tudo
function autoTab(campo, tamanho, proximo){
	if (campo.value.length == tamanho){
		proximo.focus();
	}
}
// finalidade: retorna uma mensagem se o número de caracteres informados for menor que o maxlength do input
function tamMax(campo, tMax){
	if (campo.value.length < tMax){
		alert('É necessário digitar '+ tMax +' caracteres.');
		campo.select();
		return false;
	}
	else{
		return true;
	}
}
// finalidade: precisa dizer???
function selectCampo(campo){
	campo.select;
}
// finalidade: muda a cor do Item
function NavMOver(eItem, Cor){
	eItem.DefaultBgColor = eItem.style.backgroundColor;
	eItem.DefaultTxtColor = eItem.style.color;
	eItem.style.backgroundColor = Cor;
	eItem.style.cursor="hand";	
}
// finalidade: volta à cor defaut
function NavMOut(eItem){
	eItem.style.backgroundColor = eItem.DefaultBgColor;
}
//finalidade: precisa dizer???
function chamaUrl(url, opc){
	var x = 0;
	var y = 0;
	if (opc == 0) {
		document.location.href=url
	}
	else{
	  x = screen.width - 10;
	  y = screen.height - 80;
	
		window.open(url,'','toolbar=yes,location=no,status=yes,menubar=no,resizable=yes,scrollbars=yes,top=0,left=0,width='+x+',height='+y)
	}
}

// pesquisa na página
	var NS4 = (document.layers);
	var IE4 = (document.all);
	var win = this;
	var n = 0;

function findInPage(str) {
	var txt, i, found;
	if (str == "")
		return false;
	if (NS4) {
		if (!win.find(str))
			while(win.find(str, false, true))
				n++;
		else
			n++;
		if (n == 0) alert(str + " não encontrado(a) nesta página.");
	}
	
	if (IE4) {
		txt = win.document.body.createTextRange();
		for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
			txt.moveStart("character", 1);
			txt.moveEnd("textedit");
		}
		if (found) {
			txt.moveStart("character", -1);
			txt.findText(str);
			txt.select();
			txt.scrollIntoView();
			n++;
		}
		else {
			if (n > 0) {
				n = 0;
				findInPage(str);
			}
			else 
				alert(str + " não encontrado(a) nesta página.");
		}
	}
	return false;
} 
