// Funcao para colocar a "/" automaticamente na data
function formataData(campo, teclapres) {
	var tecla = teclapres.keyCode;
	var vr = new String(campo.value);
	vr = vr.replace("/", "");
	vr = vr.replace("/", "");
	vr = vr.replace("/", "");
	vr = vr.replace("/", "");
	vr = vr.replace("/", "");
	tam = vr.length + 1;

	// verifica se nao eh backspace nem TAB
	if (tecla != 9 && tecla != 8) {
		if (tam > 2 && tam < 5)
			campo.value = vr.substr(0, 2) + '/' + vr.substr(2, tam);
		if (tam >= 5 && tam <=10)
			campo.value = vr.substr(0,2) + '/' + vr.substr(2,2) + '/' + vr.substr(4,4);
	}
}

function pula_campo(campo1,campo2,campo3){			
	if ((eval('form1.'+campo1).value.length) == eval(campo3)) {
		eval('form1.'+campo2).focus();
	}	
}

//função para aceitar somente numeros e pontos
function soNumeros() { 
	tecla = event.keyCode; 
	if (tecla >= 48 && tecla <= 57) return true; 
	else return false; 
}

function mascaraCEP(e,src,mask){
	if(window.event)
		_TXT = e.keyCode;
	else if(e.which)
		 _TXT = e.which;
	if(_TXT != undefined && (_TXT > 47 && _TXT < 58)) {
		var i = src.value.length;
		var saida = mask.substring(0,1);
		var texto = mask.substring(i);
		if(texto.substring(0,1) != saida)
	 		src.value += texto.substring(0,1);
		return true;
	} else {
		if(_TXT != undefined && _TXT != 8)
			return false;
		else
			return true;
	}
}