<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function abrir_janela_popup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}


function validarContato()
{
	msgErros = '';
	cntErros = 0;
	with (document.formContato)
	{
		if (Nome.value.length < 3)
		{
			msgErros += "-> Nome\n";
			cntErros++;
		}
		
			
		if (Endereco.value.length < 5)
		{
			msgErros += "-> Endereço\n";
			cntErros++;
		}
		

		
		if (Cidade.value.length < 3)
		{
			msgErros += "-> Cidade\n";
			cntErros++;
		}
		
		if (UF.value.length < 2)
		{
			msgErros += "-> UF\n";
			cntErros++;
		}
		
	
		if (Telefone.value.length < 6)
		{
			msgErros += "-> Fone\n";
			cntErros++;
		}
		
		
		if (Email.value.length < 6)
		{
			msgErros += "-> Email\n";
			cntErros++;
		}
		else
		{
			if (Email.value.indexOf('@',0)==-1 ||
				Email.value.indexOf('@',0)== 0 ||
				Email.value.indexOf('.',0)==-1)
      	{
            msgErros += "-> Email (é inválido)\n";
				cntErros++;
      	}
		}
		
		if (Mensagem.value.length < 5)
		{
			msgErros += "-> Mensagem\n";
			cntErros++;
		}
	
		if (cntErros > 0)
		{
			alert("Você precisa preencher corretamente o(s) campo(s)\n abaixo para poder enviar o formulário:\n" + msgErros);
		}
		else
		{
			if (confirm("Você está de acordo com as informações contidas no formulário?"))
			{
				action = "envia_mail.php";
				submit();
			}
		}
	}

}






function validarCurriculo()
{
	msgErros = '';
	cntErros = 0;
	with (document.formCurriculo)
	{
		if (Nome.value.length < 3)
		{
			msgErros += "-> Nome\n";
			cntErros++;
		}
		
		if (Endereco.value.length < 6)
		{
			msgErros += "-> Endereço\n";
			cntErros++;
		}
		
		if (Bairro.value.length < 4)
		{
			msgErros += "-> Bairro\n";
			cntErros++;
		}
		
		if (CEP.value.length < 6)
		{
			msgErros += "-> CEP\n";
			cntErros++;
		}
		
		if (Cidade.value.length < 6)
		{
			msgErros += "-> Cidade\n";
			cntErros++;
		}
		
		
		if (UF.value.length < 2)
		{
			msgErros += "-> UF\n";
			cntErros++;
		}
		
		
		if (Telefone.value.length < 6)
		{
			msgErros += "-> Telefone\n";
			cntErros++;
		}
		
		
		if (Email.value.length < 6)
		{
			msgErros += "-> Email\n";
			cntErros++;
		}
		else
		{
			if (Email.value.indexOf('@',0)==-1 ||
				Email.value.indexOf('@',0)== 0 ||
				Email.value.indexOf('.',0)==-1)
      	{
            msgErros += "-> Email (é inválido)\n";
				cntErros++;
      	}
		}
		

	
		if (cntErros > 0)
		{
			alert("Você precisa preencher corretamente o(s) campo(s)\n abaixo para poder enviar o formulário:\n" + msgErros);
		}
		else
		{
			action = "envia_mail.php";
			submit();
		}
	}

}


function CPFValido(st) {
    

if (st=="") return (false);
ok=false;

    for (i=0;i<(st.length-1);i++){
        prev=st.charAt(i)
        next=st.charAt(i+1)
        if ( prev != next)
            ok=true;
    }

    if ( ok != true )
        return (false)

        l = st.length;
        st2 = "";
        for (i = 0; i < l; i++) {
                caracter = st.charAt(i,i+1)
                if ((caracter >= '0') && (caracter <= '9'))
                        st2 = st2 + caracter;
        }
   if ((st2.length > 11) || (st2.length < 10))
        return (false);
        if (st2.length==10)
                st2 = '0' + st2;
        digito1 = st2.charAt(9,10)
        digito2 = st2.charAt(10,11)

        digito1 = parseInt(digito1,10)
        digito2 = parseInt(digito2,10)

        sum = 0; mul = 10;
        for (i = 0; i < 9 ; i++) {
        digit = st2.substring(i,i+1);
                tproduct = parseInt(digit ,10)*mul;
      sum += tproduct;
                mul--;
   }
        dig1 = ( sum % 11 )
        if ( dig1==0 || dig1==1 )
                dig1=0;
        else
                dig1 = 11 - dig1

        if (dig1!=digito1)
                return (false);

        sum = 0; mul = 11;
        for (i = 0; i < 10 ; i++) {
        digit = st2.substring(i,i+1);
                tproduct = parseInt(digit ,10)*mul;
      sum += tproduct;
                mul--;
        }
        dig2 = (sum % 11)

        if ( dig2==0 || dig2==1 )
                dig2=0;
        else
                dig2 = 11 - dig2;

        if (dig2!=digito2)
                return (false);
        return (true)
}


function verificaCPF(e) {
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) {
		code = e.keyCode;
		if (code < 48 || code > 57) {e.returnValue = false;}
	}
	else if (e.which) 
	{
		code = e.which;
		if (code < 48 || code > 57) {e.preventDefault()}
	}
}

function informaCPF(CPF)
{
    if (CPFValido(CPF.value)!=true) {
        alert("O CPF informado não é válido.");
    }
}

function validarCadastro()
{
	msgErros = '';
	cntErros = 0;
	with (document.formCadastro)
	{
    	
    	if (CPFValido(CPF.value)!=true) {
            msgErros += "-> CPF inválido\n";
            cntErros++;
        }
    	
    	
		if (Nome.value.length < 3)
		{
			msgErros += "-> Nome completo\n";
			cntErros++;
		}
		
		if (RG.value.length < 10)
		{
			msgErros += "-> RG\n";
			cntErros++;
		}
		
		if (CPF.value.length < 10)
		{
			msgErros += "-> CPF\n";
			cntErros++;
		}
		
		if (Endereco.value.length < 8)
		{
			msgErros += "-> Endereço\n";
			cntErros++;
		}
		
		if (DataNascimento.value.length < 6)
		{
			msgErros += "-> Cidade\n";
			cntErros++;
		}
		
		if (Cidade.value.length < 6)
		{
			msgErros += "-> Cidade\n";
			cntErros++;
		}
		
		if (Telefone.value.length < 6)
		{
			msgErros += "-> Fone\n";
			cntErros++;
		}
		
		if (Celular.value.length < 6)
		{
			msgErros += "-> Celular\n";
			cntErros++;
		}
		
		
		if (Email.value.length < 6)
		{
			msgErros += "-> Email\n";
			cntErros++;
		}
		else
		{
			if (Email.value.indexOf('@',0)==-1 ||
				Email.value.indexOf('@',0)== 0 ||
				Email.value.indexOf('.',0)==-1)
      	{
            msgErros += "-> Email (é inválido)\n";
				cntErros++;
      	}
		}
		
	
		if (cntErros > 0)
		{
			alert("Você precisa preencher corretamente o(s) campo(s)\n abaixo para poder enviar o formulário:\n" + msgErros);
		}
		else
		{
			action = "envia_mail_revenda.php";
			submit();
		}
	}

}



function validarOrcamento()
{
	msgErros = '';
	cntErros = 0;
	with (document.formOrcamento)
	{
		if (Nome.value.length < 3)
		{
			msgErros += "-> Nome\n";
			cntErros++;
		}
		
		
		if (RG.value.length < 10)
		{
			msgErros += "-> RG\n";
			cntErros++;
		}
		
		if (CPF.value.length < 10)
		{
			msgErros += "-> CPF\n";
			cntErros++;
		}

		if (Endereco.value.length < 5)
		{
			msgErros += "-> Endereço\n";
			cntErros++;
		}
		
		if (Cidade.value.length < 3)
		{
			msgErros += "-> Cidade\n";
			cntErros++;
		}
		
		if (UF.value.length < 2)
		{
			msgErros += "-> UF\n";
			cntErros++;
		}
		
	
		if (Telefone.value.length < 6)
		{
			msgErros += "-> Fone\n";
			cntErros++;
		}
		
		
		if (Email.value.length < 6)
		{
			msgErros += "-> Email\n";
			cntErros++;
		}
		else
		{
			if (Email.value.indexOf('@',0)==-1 ||
				Email.value.indexOf('@',0)== 0 ||
				Email.value.indexOf('.',0)==-1)
      	{
            msgErros += "-> Email (é inválido)\n";
				cntErros++;
      	}
		}
		
		if (Mensagem.value.length < 5)
		{
			msgErros += "-> Mensagem\n";
			cntErros++;
		}
	
		if (cntErros > 0)
		{
			alert("Você precisa preencher corretamente o(s) campo(s)\n abaixo para poder enviar o formulário:\n" + msgErros);
		}
		else
		{
				action = "envia_orcamento.php";
				submit();
		}
	}

}



var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
    if (event.button==2){
        //alert(message);
        return false;
    }
}

function clickNS4(e){
    if (document.layers||document.getElementById&&!document.all){
        if (e.which==2||e.which==3){
            //alert(message);
            return false;
        }
    }
}

if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS4;
}
    else if (document.all&&!document.getElementById){
    document.onmousedown=clickIE4;
}


//-->