/*----------------------------------------------------------------------------
validar form
-----------------------------------------------------------------------------*/
function ValidarForm(form) {
	
	//
	for (i=0; i<form.length; i++) {
	
		var obg = form[i].obrigatorio;
	
		//
		if (form[i].value == "" && form[i].type != 'hidden' && form[i].title != '') {
			var title = form[i].title
			alert("Campo " + title.toUpperCase() + " é obrigatório, favor preencher !")
			form[i].focus();
			return false
		}
			
	}
		
	return true
	
}


/*----------------------------------------------------------------------------
somente numeros
-----------------------------------------------------------------------------*/
function SomenteNumero(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        status = "This field accepts numbers only."
        return false
    }
    status = ""
    return true
}



/*----------------------------------------------------------------------------
formatacao para qualquer mascara
-----------------------------------------------------------------------------*/
//Mascara(this, '##-####-####')
function Mascara(campo, tecla, mask) {

	//
    var charCode = (tecla.which) ? tecla.which : tecla.keyCode
	
	//
	if (charCode != 8) {
		
		//
		var i = campo.value.length;
		var saida = mask.substring(0,1);
		var texto = mask.substring(i);
		
		//
		if (texto.substring(0,1) != saida)
			campo.value += texto.substring(0,1);

	}
	
}

