function FormataCep(form, campo, teclapres){
	var tecla = teclapres.keyCode;

	var vr = new String(document.forms[form].elements[campo].value);
	vr = vr.replace("-", "");
	vr = vr.replace(".", "");

	tam = vr.length + 1;

	if (tecla != 9 && tecla != 8){
		if (tam > 2 && tam < 6)
			document.forms[form].elements[campo].value = vr.substr(0, 2) + '.' + vr.substr(2, tam);
		if (tam >= 6)
			document.forms[form].elements[campo].value = vr.substr(0,2) + '.' + vr.substr(2,3) + '-' + vr.substr(5,3);
	}

	KeyTab();
}

function TestaCep(cCep){
	var hora;
	hora = LimpaCampo(cCep.value,10);
	var tam = hora.length;
	if	((tam!=8)){
        ControleDeErro(cCep, GetSubStr(cCep.id, ',', 0));
		return(false);
	}
}


