function somente_numero(campo)
{
var digits="0123456789:/"
var campo_temp
   for (var i=0;i<campo.value.length;i++)
   {
      campo_temp=campo.value.substring(i,i+1)
	  if (digits.indexOf(campo_temp)==-1)
      {
         campo.value = campo.value.substring(0,i);
		 break;
	   }
	}
}

function valida_reserva1(theForm)
{
    
    if (theForm.matricula.value == "")
    {
        alert("ERRO:\nMatrícula não informada.");
        theForm.matricula.focus();
        return false;
    }
    if (theForm.associado.value == "")
    {
        alert("ERRO:\nNome do sindicalizado não informado.");
        theForm.associado.focus();
        return false;
    }
    if (theForm.email.value == "")
    {
        alert("ERRO:\nEndereço eletrônico não informado.");
        theForm.email.focus();
        return false;
    }
    if (theForm.email.value != "")
    {
        re=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
        if(!re.test(theForm.email.value))
        {
            alert("ERRO:\nEndereço eletrônico inválido.");
            theForm.email.focus();
            return false;
        }
    }
    if (theForm.m.value == 0 && theForm.f.value == 0 && theForm.c.value == 0)
    {
        alert("ERRO:\nNúmero de vagas não informado.");
        theForm.m.focus();
        return false;
    }
    if (theForm.data.value == "")
    {
        alert("ERRO:\nData de entrada não informada.");
        theForm.data.focus();
        return false;
    }
    if (theForm.entrada.value == "")
    {
        alert("ERRO:\nHorário de entrada não informada.");
        theForm.data.focus();
        return false;
    }
    if (theForm.saida.value == "")
    {
        alert("ERRO:\nHorário de saída não informada.");
        theForm.data.focus();
        return false;
    }
}


function valida_contato(theForm) 
{

        if (theForm.nome.value == ""){
            alert("ERRO:\nNome não informado.");
            theForm.nome.focus();
            return false;
        }
        
        if (theForm.email.value == ""){
            alert("ERRO:\nEndereço eletrônico não informado.");
            theForm.nome.focus();
            return false;
        }

        if (theForm.email.value != ""){
            re=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
            if(!re.test(theForm.email.value)){
                alert("ERRO:\nEndereço eletrônico inválido.");
                theForm.email.focus();
                return false;
            }
        }
     
        if (theForm.assunto.value == ""){
            alert("ERRO:\nAssunto não informado.");
            return false;
        }

        if (theForm.mensagem.value == ""){
            alert("ERRO:\nNenhuma mensagem informada.");
            return false;
        }
    
        return true;
}


function valida_permuta(theForm)
{
    if (theForm.nome.value == "")
    {
        alert("ERRO:\nNome não informado.");
        theForm.nome.focus();
        return false;
    }
    
    if (theForm.cargo.value == "")
    {
        alert("ERRO:\nCargo não informado.");
        theForm.cargo.focus();
        return false;
    }
    
    if (theForm.locatual.value == "")
    {
        alert("ERRO:\nLocal atual não informado.");
        theForm.locatual.focus();
        return false;
    }
    
    if (theForm.locpret.value == "")
    {
        alert("ERRO:\nLocal Pretendido não informado.");
        theForm.locpret.focus();
        return false;
    }
    
    if (theForm.email.value == "")
    {
        alert("ERRO:\nEndereço eletrônico não informado.");
        theForm.email.focus();
        return false;
    }

    if (theForm.email.value != "")
    {
        re=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
        if(!re.test(theForm.email.value))
        {
            alert("ERRO:\nEndereço eletrônico inválido.");
            theForm.email.focus();
            return false;
        }
    }
    
    return true;
}



function janela(URL, w, h)
{
var top = ((window.screen.height - 100) - h)/2;
var left = (window.screen.width - w)/2;

    var j = window.open(URL,"dsr", "top=" + top + ",left=" + left + ", width=" + w + ", height=" + h + ", toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,scrolling=no,resizable=no");
    j.focus();
}

function janelaAdm(URL)
{ 
var h = window.screen.height - 100;
var w = window.screen.width;
var top = (h - 500)/2;
var left = (w - 650)/2;

    window.open(URL,"adm", "top=" + top + ",left=" + left + ", width=650, height=500, toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,scrolling=yes,resizable=no");

}


function valida_assembleia0515(theForm)
{
    if (theForm.matricula.value == "")
    {
        alert("ERRO:\nMatricula não informada.");
        theForm.matricula.focus();
        return false;
    }

    if (theForm.nome.value == "")
    {
        alert("ERRO:\nNome não informado.");
        theForm.nome.focus();
        return false;
    }

    return true;
}

function valida_festa_menudo(theForm)
{
    if (theForm.matricula.value == "")
    {
        alert("ERRO:\nMatricula não informada.");
        theForm.matricula.focus();
        return false;
    }

    if (theForm.nome.value == "")
    {
        alert("ERRO:\nNome não informado.");
        theForm.nome.focus();
        return false;
    }

    return true;
}


function formatar(src, mask) 
{
    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);
    }
}
