<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function verifica()
{
	if ((document.busca.nota_fiscal.value == '') || (document.busca.nota_fiscal.value == 'Nota Fiscal'))
	{
		alert('Preencha corretamente o campo Nota Fiscal!');
		document.busca.nota_fiscal.focus();
		document.busca.nota_fiscal.value = '';
		return false;
	}
	if ((document.busca.cnpj.value == '') || (document.busca.cnpj.value == 'CNPJ'))
	{
		alert('Preencha corretamente o campo CPF/CNPJ!');
		document.busca.cnpj.focus();
		document.busca.cnpj.value = '';
		return false;
	}
	
}
//-->

<!--
function blockNumbers(e)
{
var key;
var keychar;
var reg;

if(window.event) {
  // for IE, e.keyCode or window.event.keyCode can be used
  key = e.keyCode; 
}
else if(e.which) {
  // netscape
  key = e.which; 
}
else {
  // no event, so pass through
  return true;
}

keychar = String.fromCharCode(key);
reg = /\d/;
// return !reg.test(keychar); ===> para tirar números é necessário tirar o exclamação (!)
        return reg.test(keychar);
}
//-->

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


    function verifica_contato()
    {
        if (document.form_contato.id.value == '')
        {
            alert('selecione o campo de atendimento!');
            document.form_contato.id.focus();
            return false;
        }

       if (document.form_contato.nome.value == '')
        {
            alert('Preencha corretamente o campo NOME!');
            document.form_contato.nome.focus();
            return false;
        }
		
		
        if (form1.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)
        {
            alert("Informe seu e-mail corretamente!");
            form1.email.focus();
            return false;
        }
		if (document.form_contato.ddd.value == '')
        {
            alert('Preencha corretamente o campo DDD!');
            document.form_contato.ddd.focus();
            return false;
        }
		
		 if (document.form_contato.telefone.value == '')
        {
            alert('Preencha corretamente o campo telefone!');
            document.form_contato.telefne.focus();
            return false;
        }
		
		 if (document.form_contato.cidade.value == '')
        {
            alert('Preencha corretamente o campo Cidade!');
            document.form_contato.cidade.focus();
            return false;
        }
		
		 if (document.form_contato.mensagem.value == '')
        {
            alert('Preencha corretamente o campo Mensagem!');
            document.form_contato.mensagem.focus();
            return false;
        }

    }


function limpa_string(s){ // Deixa só os digitos no numero
	var digitos = "0123456789";
	var temp = "";
	var digito = "";

    for (var i=0; i<s.length; i++){
		digito = s.charAt(i);
		if (digitos.indexOf(digito)>=0){temp=temp+digito}
	}
	return temp
}

function Mascara (formato, keypress, objeto)
{
  campo = eval(objeto);
  
  // CPF
		if (formato == 'CPF')
		{
			var s = limpa_string(campo.value);
			if (s.length == 3)
				campo.value = s.substr(0, 3) + '.';
			else if (s.length == 6)
				campo.value = s.substr(0, 3) + '.' + s.substr(3, 3) + '.';
			else if (s.length == 9)
				campo.value = s.substr(0, 3) + '.' + s.substr(3, 3) + '.' + s.substr(6, 3) + '-';
		}

  // DATA
		if (formato == 'DATA')
		{
			separador = '/'; 
			conjunto1 = 2;
			conjunto2 = 5;
			if (campo.value.length == conjunto1) campo.value += separador;
			if (campo.value.length == conjunto2) campo.value += separador;
		}
		
  // CEP
		if (formato == 'CEP')
		{
			separador = '-'; 
			conjunto1 = 5;
			if (campo.value.length == conjunto1) campo.value += separador;
		}
		if (formato == 'TELEFONE')
		{
			var s = limpa_string(campo.value);
			var i = 0;
			if (s.substr(0, 1) == '0') i = 1;
			if (s.length == 6)
				campo.value = s.substr(0, 4) + '-' + s.substr(4, 4);
			else if (s.length == (8 + i))
				campo.value = s.substr(0, 2 + i) + ' ' + s.substr(2 + i, 3) + '-' + s.substr(5 + i, 4);
			else if (s.length == (9 + i) && keypress != 13)
				campo.value = s.substr(0, 2 + i) + ' ' + s.substr(2 + i, 4) + '-' + s.substr(6 + i, 4);
		}
		
  //CNPJ
  if (formato == 'CNPJ'){

   var vr = new String(campo.value);
   vr = vr.replace(".", "");
   vr = vr.replace(".", "");
   vr = vr.replace("/", "");
   vr = vr.replace("-", "");

   tam = vr.length + 1;

   
   if (keypress != 9 && keypress != 8){
      if (tam > 2 && tam < 6)
         campo.value = vr.substr(0, 2) + '.' + vr.substr(2, tam);
      if (tam >= 6 && tam < 9)
         campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,tam-5);
      if (tam >= 9 && tam < 13)
         campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,tam-8);
      if (tam >= 13 && tam < 15)
         campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4)+ '-' + vr.substr(12,tam-12);
      }
	  
  }
  
  // MOEDA
		if (formato == 'MOEDA')
		{
			vr = campo.value;
			vr = vr.replace("/", "");
			vr = vr.replace("/", "");
			vr = vr.replace(",", "");
			vr = vr.replace(".", "");
			vr = vr.replace(".", "");
			vr = vr.replace(".", "");
			vr = vr.replace(".", "");
			tam = vr.length;
			tammax = 13;
			if (tam < tammax && keypress != 8) tam = vr.length + 1;
			if (keypress == 8) tam = tam - 1;
			if (keypress == 8 || keypress >= 48 && keypress <= 57 || keypress >= 96 && keypress <= 105){
				if (tam <= 2)
					campo.value = vr;
	 			if ((tam > 2) && (tam <= 5))
					campo.value = vr.substr(0, tam - 2) + ',' + vr.substr(tam - 2, tam);
	 			if ((tam >= 6) && (tam <= 8))
	 				campo.value = vr.substr(0, tam - 5) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
	 			if ((tam >= 9) && (tam <= 11))
	 				campo.value = vr.substr(0, tam - 8) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
	 			if ((tam >= 12) && (tam <= 14))
	 				campo.value = vr.substr(0, tam - 11) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
	 			if ((tam >= 15) && (tam <= 17))
	 				campo.value = vr.substr(0, tam - 14) + '.' + vr.substr(tam - 14, 3) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
			}
		}

// NUMERO
		var c = String.fromCharCode(keypress);
		if (isNaN(c) || keypress == 32) return false;

}

    var linhas_endividamento = 1;
    function novalinha_endividamento()
	{
		{
		linhas_endividamento++;
	    endividamento_addlinhas.insertAdjacentHTML ('beforeBegin', '<table width="100%" border="0" cellspacing="2" cellpadding="2"><tr><td><input name="endividamento_instituicao'+ linhas_endividamento +'" type="text" size="12" maxlength="50" /></td><td><input name="endividamento_modalidade'+ linhas_endividamento +'" type="text" size="12" maxlength="50" /></td><td><input name="endividamento_limite'+ linhas_endividamento +'" type="text" size="12" maxlength="10" onKeyPress="return Mascara(\'MOEDA\', window.event.keyCode, this);" /></td><td><input name="endividamento_saldo_devedor'+ linhas_endividamento +'" type="text" size="12" maxlength="10" onKeyPress="return Mascara(\'MOEDA\', window.event.keyCode, this);" /></td><td><input name="endividamento_valor_parcela'+ linhas_endividamento +'" type="text" size="12" maxlength="10" onKeyPress="return Mascara(\'MOEDA\', window.event.keyCode, this);" /></td></tr></table>');
		document.form1.endividamento_linhas.value = linhas_endividamento;
	    }
	}
	
	var linhas_frota = 1;
    function novalinha_frota()
	{
		{
		linhas_frota++;
	    frota_addlinhas.insertAdjacentHTML ('beforeBegin', '<br /><table width="710" border="0" cellspacing="2" cellpadding="2"><tr><td colspan="2" class="txtmarrom">Marca/modelo/Ano<br /><input name="frota_marca'+ linhas_frota +'" type="text" size="35" maxlength="100" /></td><td width="109" class="txtmarrom">Placa<br /><input name="frota_placa'+ linhas_frota +'" type="text" size="12" maxlength="20" /></td><td width="149" class="txtmarrom">Renavan<br /><input name="frota_renavan'+ linhas_frota +'" type="text" size="20" maxlength="50" /></td><td width="159" class="txtmarrom">CRV<br /><input name="frota_crv'+ linhas_frota +'" type="text" size="20" maxlength="50" /></td></tr><tr><td width="178" class="txtmarrom">O bem citado &eacute; financiado?<br /><select name="frota_financiado'+ linhas_frota +'"><option value="sim">Sim</option><option value="nao">N&atilde;o</option></select></td><td width="115" class="txtmarrom">Em qual banco?<br /><input name="frota_banco'+ linhas_frota +'" type="text" size="12" maxlength="50" /></td><td class="txtmarrom">Qual Prazo?<br /><input name="frota_prazo'+ linhas_frota +'" type="text" size="12" maxlength="50" /></td><td class="txtmarrom">Quantas parcelas faltam?<br /><input name="frota_parcelas'+ linhas_frota +'" type="text" size="12" maxlength="10" /></td><td class="txtmarrom">Valor da parcela<br /><input name="frota_valor_parcela'+ linhas_frota +'" type="text" onKeyPress="return Mascara(\'MOEDA\', window.event.keyCode, this);" size="12" maxlength="10" /></td></tr></table>');
		document.form1.frota_linhas.value = linhas_frota;
	    }
	}
	
	
	    function verifica2()
    {
        if (document.form1.name.value == '')
        {
            alert('Preencha corretamente o campo Nome!');
            document.form1.name.focus();
            return false;
        }

       if (document.form1.cnpj.value == '')
        {
            alert('Preencha corretamente o campo CNPJ!');
            document.form1.cnpf.focus();
            return false;
        }
		
		 if (document.form1.endereco.value == '')
        {
            alert('Preencha corretamente o campo Endereco!');
            document.form1.endereco.focus();
            return false;
        }
		
		 if (document.form1.bairro.value == '')
        {
            alert('Preencha corretamente o campo Bairro!');
            document.form1.bairro.focus();
            return false;
        }
		 
		  if (document.form1.cep.value == '')
        {
            alert('Preencha corretamente o campo CEP!');
            document.form1.CEP.focus();
            return false;
        }
		
		 if (document.form1.city.value == '')
        {
            alert('Preencha corretamente o campo Cidade!');
            document.form1.city.focus();
            return false;
        }
		
		 if (document.form1.tel.value == '')
        {
            alert('Preencha corretamente o campo Telefone!');
            document.form1.tel.focus();
            return false;
        }
		
        if (form1.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)
        {
            alert("Informe seu e-mail corretamente!");
            form1.email.focus();
            return false;
        }
		
		 if (document.form1.peso.value == '')
        {
            alert('Preencha corretamente o campo Peso!');
            document.form1.peso.focus();
            return false;
        }
		
		 if (document.form1.valor.value == '')
        {
            alert('Preencha corretamente o campo Valor!');
            document.form1.valor.focus();
            return false;
        }
		
		 if (document.form1.comprimento.value == '')
        {
            alert('Preencha corretamente o campo Comprimento!');
            document.form1.comprimento.focus();
            return false;
        }
		
		 if (document.form1.largura.value == '')
        {
            alert('Preencha corretamente o campo largura!');
            document.form1.largura.focus();
            return false;
        }
		
		 if (document.form1.altura.value == '')
        {
            alert('Preencha corretamente o campo Altura!');
            document.form1.altura.focus();
            return false;
        }
		
		 if (document.form1.especie.value == '')
        {
            alert('Preencha corretamente o campo Espécie!');
            document.form1.especie.focus();
            return false;
        }
		

    }
	
	var popfoto;
function popup(link, width, height){
	if (popfoto) popfoto.close();
	popfoto = window.open (link, 'popup', 'width=580,height=500,top=30,left=30, scrollbars=no,status=no');
}

