// Java Document
function mascara(tipo, campo, teclaPress) {
	    if (window.event) {
	      var tecla = teclaPress.keyCode;
        } else {
          tecla = teclaPress.which;
        }
	     var s = new String(campo.value);

// Remove todos os caracteres à seguir: ( ) / - . e espaço, para tratar a string denovo.
        s = s.replace(/(\.|\(|\)|\/|\-| )+/g,'');
        tam = s.length + 1;
        if ( tecla != 9 && tecla != 8 ) {
        switch (tipo){
        case 'Fone' :
        if (tam > 2 && tam < 4)
       campo.value = '(' + s.substr(0,2) + ') ' + s.substr(2,tam);
       if (tam >= 7 && tam < 11)
      campo.value = '(' + s.substr(0,2) + ') ' + s.substr(2,4) + '-' + s.substr(6,tam-6);
       break;

       case 'Data' :
       if (tam > 2 && tam < 4)
       campo.value = s.substr(0,2) + '/' + s.substr(2, tam);
       if (tam > 4 && tam < 11)
       campo.value = s.substr(0,2) + '/' + s.substr(2,2) + '/' + s.substr(4,tam-4);
       break;        

       case 'Cep' :
       if (tam > 5 && tam < 7)
       campo.value = s.substr(0,5) + '-' + s.substr(5, tam);
       break;
      }
    }
 }

//--->Função para verificar se o valor digitado é número...<---
function digitos(event){
         if (window.event) {
        // IE
         key = event.keyCode;
         } else if ( event.which ) {
         // netscape
        key = event.which;
         }

     if ( key != 8 || key != 13 || key < 48 || key > 57 )
     return ( ( ( key > 47 ) && ( key < 58 ) ) || ( key == 8 ) || ( key == 13 ) );
     return true;
     }

function validarData(campo) {
		var expReg = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
		var msgErro = 'Formato inválido de data.';
		if ((campo.value.match(expReg)) && (campo.value!='')) {
			//alert('Data válida');
		} else if (campo.value!='') {
			//campo.focus();
			alert(msgErro);
			campo.value = "";
			campo.focus();
		}
	}

	function excluirUsuario(pOid, pContrato) {
		var confirma = confirm("Deseja Excluir esse Usuario?");
		if(confirma) {
			document.forms[0].action = 'contas_del.php?deleta='+pOid;
			document.forms[0].submit();		
		}				
	}