// JavaScript Document

<!--
function ativa_pessoa(Form_PSS,pessoa){
	if (pessoa=='J'){
		ativa_juridica(Form_PSS);
	}else{
		ativa_fisica(Form_PSS);
	}
}
function ativa_fisica(Form_HT){
  document[Form_HT].pessoa_temp.value='F';
  document[Form_HT].nome.disabled=false;
  document[Form_HT].nome.style.background='#efefef';
  document[Form_HT].estadocivil.disabled=false;
  document[Form_HT].estadocivil.style.background='#efefef';
  document[Form_HT].cpf.disabled=false;
  document[Form_HT].cpf.style.background='#efefef';
  document[Form_HT].rg.disabled=false;
  document[Form_HT].rg.style.background='#efefef';
  document[Form_HT].emissor.disabled=false;
  document[Form_HT].emissor.style.background='#efefef';
  document[Form_HT].dia.disabled=false;
  document[Form_HT].dia.style.background='#efefef';
  document[Form_HT].mes.disabled=false;
  document[Form_HT].mes.style.background='#efefef';
  document[Form_HT].ano.disabled=false;
  document[Form_HT].ano.style.background='#efefef';
  document[Form_HT].sexo.disabled=false;
  document[Form_HT].sexo.style.background='#efefef';
  document[Form_HT].cep.disabled=false;
  document[Form_HT].cep.style.background='#efefef';
  document[Form_HT].TxtExterior.disabled=false;
  //============================= função=======================
//  document[Form_HT].arquiteto.disabled=false;
//  document[Form_HT].decorador.disabled=false;

  document[Form_HT].razao.disabled=true;
  document[Form_HT].razao.style.background='#DCDCDC';
  document[Form_HT].nome_contato.disabled=true;
  document[Form_HT].nome_contato.style.background='#DCDCDC';
  document[Form_HT].cnpj.disabled=true;
  document[Form_HT].cnpj.style.background='#DCDCDC';
  document[Form_HT].ie.disabled=true;
  document[Form_HT].ie.style.background='#DCDCDC';
  document[Form_HT].ie_isento.disabled=true;
  document[Form_HT].ie_isento.checked=false;
  
}

function ativa_juridica(Form_HT){
  document[Form_HT].pessoa_temp.value='J';
  document[Form_HT].razao.disabled=false;
  document[Form_HT].razao.style.background='#efefef';
  document[Form_HT].nome_contato.disabled=false;
  document[Form_HT].nome_contato.style.background='#efefef';
  document[Form_HT].cnpj.disabled=false;
  document[Form_HT].cnpj.style.background='#efefef';
  document[Form_HT].ie.disabled=false;
  document[Form_HT].ie.style.background='#efefef';
  document[Form_HT].ie_isento.disabled=false;
  document[Form_HT].cep.disabled=false;
  document[Form_HT].cep.style.background='#efefef';

  document[Form_HT].nome.disabled=true;
  document[Form_HT].nome.style.background='#DCDCDC';
  document[Form_HT].estadocivil.disabled=true;
  document[Form_HT].estadocivil.style.background='#DCDCDC';
  document[Form_HT].cpf.disabled=true;
  document[Form_HT].cpf.style.background='#DCDCDC';
  document[Form_HT].rg.disabled=true;
  document[Form_HT].rg.style.background='#DCDCDC';
  document[Form_HT].emissor.disabled=true;
  document[Form_HT].emissor.style.background='#DCDCDC';
  document[Form_HT].dia.disabled=true;
  document[Form_HT].dia.style.background='#DCDCDC';
  document[Form_HT].mes.disabled=true;
  document[Form_HT].mes.style.background='#DCDCDC';
  document[Form_HT].ano.disabled=true;
  document[Form_HT].ano.style.background='#DCDCDC';
  document[Form_HT].sexo.disabled=true;
  document[Form_HT].sexo.style.background='#DCDCDC';
  document[Form_HT].TxtExterior.disabled=true;
//==================================================== função
//  document[Form_HT].arquiteto.disabled=true;
//  document[Form_HT].decorador.disabled=true;
//  document[Form_HT].crea.disabled=true;
//  document[Form_HT].crea.style.background='#DCDCDC';
//  document[Form_HT].abd_np.disabled=true;
//  document[Form_HT].abd_np.style.background='#DCDCDC';
}

function ativa_crea(Form_AD){
  document[Form_AD].crea.disabled=false;
  document[Form_AD].crea.style.background='#efefef';
  document[Form_AD].abd_np.disabled=true;
  document[Form_AD].abd_np.style.background='#DCDCDC';
}

function ativa_abd(Form_AD){
  document[Form_AD].abd_np.disabled=false;
  document[Form_AD].abd_np.style.background='#efefef';
  document[Form_AD].crea.disabled=true;
  document[Form_AD].crea.style.background='#DCDCDC';
}

function ativa_Nenhum(Form_AD){
  document[Form_AD].crea.disabled=true;
  document[Form_AD].crea.style.background='#DCDCDC';
  document[Form_AD].abd_np.disabled=true;
  document[Form_AD].abd_np.style.background='#DCDCDC';
}


function ativa_Exterior(campo,Form_HT){
	if(campo.checked==true){
	  document[Form_HT].cpf.disabled=true;
	  document[Form_HT].cpf.style.background='#DCDCDC';
	  document[Form_HT].rg.disabled=true;
	  document[Form_HT].rg.style.background='#DCDCDC';
	  document[Form_HT].emissor.disabled=true;
	  document[Form_HT].emissor.style.background='#DCDCDC';
	}else{
	  document[Form_HT].cpf.disabled=false;
	  document[Form_HT].cpf.style.background='#efefef';
	  document[Form_HT].rg.disabled=false;
	  document[Form_HT].rg.style.background='#efefef';
	  document[Form_HT].emissor.disabled=false;
	  document[Form_HT].emissor.style.background='#efefef';
	}
}

function envia_form_heth(Form_HT,tipo){
	if (document[Form_HT].pessoa_temp.value=="F"){
	  if (document[Form_HT].nome.value == ""){
		document[Form_HT].nome.focus();
		alert('Informe seu nome !');
	  }
	  else if (document[Form_HT].estadocivil.value == ""){
		document[Form_HT].estadocivil.focus();
		alert('Informe seu estado civil !');
	  }
		else if (document[Form_HT].dia.value == "" || isNaN(document[Form_HT].dia.value)==true || document[Form_HT].dia.value > 31){
			document[Form_HT].dia.focus();
			alert('Informe o dia do seu nascimento !');
		}
		else if (document[Form_HT].mes.value == "" || isNaN(document[Form_HT].mes.value)==true || document[Form_HT].mes.value > 12){
			document[Form_HT].mes.focus();
			alert('Informe o mês do seu nascimento !');
		}
		else if (document[Form_HT].ano.value == "" || isNaN(document[Form_HT].ano.value)==true || document[Form_HT].ano.value < 1900){
			document[Form_HT].ano.focus();
			alert('Informe o ano do seu nascimento !');
		}
	  else if (document[Form_HT].sexo.value == ""){
		document[Form_HT].sexo.focus();
		alert('Informe seu sexo !');
	  }
	  else if (document[Form_HT].TxtExterior.checked==false){ 
		if (document[Form_HT].rg.value == "" || isNaN(document[Form_HT].rg.value)==true){
		document[Form_HT].rg.focus();
		alert('Informe corretamente o número do RG !');
		}
		else if (document[Form_HT].emissor.value == ""){
		document[Form_HT].emissor.focus();
		alert('Informe o orgão emissor de seu RG !');
		}
		else if (document[Form_HT].cpf.value == ""){
		document[Form_HT].cpf.focus();
		alert('Informe seu número de CPF !');
		}
		else if (checa_cpf_heth(document[Form_HT].cpf.value) == false){
		document[Form_HT].cpf.focus();
		alert('Informe corretamente o número do CPF !');
		}else{
			if (tipo==1){
				envia_form_CEP(Form_HT);
			}else{
				envia_form_ADD(Form_HT);
			}
		}
	  }
/*	  
	  else if (document[Form_HT].crea.disabled==false){
		  if (document[Form_HT].crea.value == "" || isNaN(document[Form_HT].crea.value)==true){
			document[Form_HT].crea.focus();
			alert('Informe o numero da associação !');
		  }else{
			if (tipo==1){
				envia_form_CEP(Form_HT);
			}else{
				envia_form_ADD(Form_HT);
			}
		  }
	  }
	  else if (document[Form_HT].abd_np.disabled==false){
		  if (document[Form_HT].abd_np.value == "" || isNaN(document[Form_HT].abd_np.value)==true){
				document[Form_HT].abd_np.focus();
				alert('Informe o numero da associação !');
		  }else{
			if (tipo==1){
				envia_form_CEP(Form_HT);
			}else{
				envia_form_ADD(Form_HT);
			}
		  }
	  }
*/	  
	  else{
		if (tipo==1){
			envia_form_CEP(Form_HT);
		}else{
			envia_form_ADD(Form_HT);
		}
	  }
	}
	else if (document[Form_HT].pessoa_temp.value=="J"){
	  if (document[Form_HT].razao.value == ""){
		document[Form_HT].razao.focus();
		alert('Informe a razão social !');
	  }
	  else if (document[Form_HT].nome_contato.value == ""){
		document[Form_HT].nome_contato.focus();
		alert('Informe o nome contato !');
	  }
	  else if (document[Form_HT].cnpj.value == "" || isNaN(document[Form_HT].cnpj.value)==true){
		document[Form_HT].cnpj.focus();
		alert('Informe seu número de CNPJ!');
	  }
	  else if (checa_cnpj_heth(document[Form_HT].cnpj.value) == false){
		document[Form_HT].cnpj.focus();
		alert('Informe corretamente o número do CNPJ !');
	  }
	  else if (document[Form_HT].ie_isento.checked == false){
		if (document[Form_HT].ie.value == "" || isNaN(document[Form_HT].ie.value)==true){
		  document[Form_HT].ie.focus();
		  alert('Informe seu número I.E.');
		}else{
			if (tipo==1){
				envia_form_CEP(Form_HT);
			}else{
				envia_form_ADD(Form_HT);
			}
		}
	  }
	  else{
		if (tipo==1){
			envia_form_CEP(Form_HT);
		}else{
			envia_form_ADD(Form_HT);
		}
	  }
	}
}

function envia_dp(Form_HT){
	if (document[Form_HT].pessoa_temp.value=="F"){
	  if (document[Form_HT].nome.value == ""){
		document[Form_HT].nome.focus();
		alert('Informe seu nome !');
	  }
	  else if (document[Form_HT].estadocivil.value == ""){
		document[Form_HT].estadocivil.focus();
		alert('Informe seu estado civil !');
	  }
		else if (document[Form_HT].dia.value == "" || isNaN(document[Form_HT].dia.value)==true || document[Form_HT].dia.value > 31){
			document[Form_HT].dia.focus();
			alert('Informe o dia do seu nascimento !');
		}
		else if (document[Form_HT].mes.value == "" || isNaN(document[Form_HT].mes.value)==true || document[Form_HT].mes.value > 12){
			document[Form_HT].mes.focus();
			alert('Informe o mês do seu nascimento !');
		}
		else if (document[Form_HT].ano.value == "" || isNaN(document[Form_HT].ano.value)==true || document[Form_HT].ano.value < 1900){
			document[Form_HT].ano.focus();
			alert('Informe o ano do seu nascimento !');
		}
	  else if (document[Form_HT].sexo.value == ""){
		document[Form_HT].sexo.focus();
		alert('Informe seu sexo !');
	  }
	  else if (document[Form_HT].rg.value == "" || isNaN(document[Form_HT].rg.value)==true){
		document[Form_HT].rg.focus();
		alert('Informe corretamente o número do RG !');
		}
		else if (document[Form_HT].emissor.value == ""){
		document[Form_HT].emissor.focus();
		alert('Informe o orgão emissor de seu RG !');
		}
		else if (document[Form_HT].cpf.value == ""){
		document[Form_HT].cpf.focus();
		alert('Informe seu número de CPF !');
		}
		else if (checa_cpf_heth(document[Form_HT].cpf.value) == false){
		document[Form_HT].cpf.focus();
		alert('Informe corretamente o número do CPF !');
	  }
	  else{
		envia_form_ADD(Form_HT);
	  }
	}
	else if (document[Form_HT].pessoa_temp.value=="J"){
	  if (document[Form_HT].razao.value == ""){
		document[Form_HT].razao.focus();
		alert('Informe a razão social !');
	  }
	  else if (document[Form_HT].nome_contato.value == ""){
		document[Form_HT].nome_contato.focus();
		alert('Informe o nome contato !');
	  }
	  else if (document[Form_HT].cnpj.value == "" || isNaN(document[Form_HT].cnpj.value)==true){
		document[Form_HT].cnpj.focus();
		alert('Informe seu número de CNPJ!');
	  }
	  else if (checa_cnpj_heth(document[Form_HT].cnpj.value) == false){
		document[Form_HT].cnpj.focus();
		alert('Informe corretamente o número do CNPJ !');
	  }
	  else if (document[Form_HT].ie_isento.checked == false){
		if (document[Form_HT].ie.value == "" || isNaN(document[Form_HT].ie.value)==true){
		  document[Form_HT].ie.focus();
		  alert('Informe seu número I.E.');
		}else{
			envia_form_ADD(Form_HT);
		}
	  }
	  else{
			envia_form_ADD(Form_HT);
	  }
	}
}

function envia_form_CEP(Form_CEP){
	if (document[Form_CEP].cep.value == ""){
		document[Form_CEP].cep.focus();
		alert('Informe corretamente seu cep !');
	}
	else{
		document[Form_CEP].submit();
	}
}

function envia_form_ADD(Form_ADD){
	if (document[Form_ADD].email.value == ""){
	  document[Form_ADD].email.focus();
	  alert('Informe seu email !');
	}
	else if (document[Form_ADD].email.value.match(/(\w+)@(.+)\.(\w+)$/) == null){
	  document[Form_ADD].email.focus();
	  document[Form_ADD].email.select();
	  alert('Endereço de email inválido !');
	}
	else if (document[Form_ADD].senha.value == "" || document[Form_ADD].senha.value.length < 4){
	  document[Form_ADD].senha.focus();
	  alert('Mínimo 4 caracteres !');
	}
	else if (document[Form_ADD].nova_senha.value != "" && document[Form_ADD].nova_senha.value.length < 4){
		document[Form_ADD].nova_senha.focus();
		alert('Mínimo 4 caracteres !');
	}
	else if (document[Form_ADD].nova_senha.value != document[Form_ADD].confirma_nova_senha.value){
		document[Form_ADD].confirma_nova_senha.focus();
		alert('Senhas não conferem !');
	}
	else{
		document[Form_ADD].submit();
	}
}

function conclui_envio_heth(Form_HT2){
	if (document[Form_HT2].endereco.value == ""){
	  document[Form_HT2].endereco.focus();
	  alert('Informe seu endereço !');
	}
/*	
	else if (document[Form_HT2].numero.value == ""){
	  document[Form_HT2].numero.focus();
	  alert('Informe o número de sua residência !');
	}
*/	
	else if (document[Form_HT2].bairro.value == ""){
	  document[Form_HT2].bairro.focus();
	  alert('Informe seu bairro !');
	}
	/*else if (document[Form_HT2].cep.value == ""){
	  document[Form_HT2].cep.focus();
	  alert('Informe seu cep !');
	}*/
	else if (document[Form_HT2].cidade.value == ""){
	  document[Form_HT2].cidade.focus();
	  alert('Informe sua cidade !');
	}
	else if (document[Form_HT2].estado.value == ""){
	  document[Form_HT2].estado.focus();
	  alert('Informe seu Estado !');
	}
	else if (document[Form_HT2].pais.value == ""){
	  document[Form_HT2].pais.focus();
	  alert('Informe seu País !');
	}
	/*else if (document[Form_HT2].telefone.value == ""){
	  document[Form_HT2].telefone.focus();
	  alert('Informe seu telefone !');
	}*/
	else if (document[Form_HT2].email.value == ""){
	  document[Form_HT2].email.focus();
	  alert('Informe seu email !');
	}
	else if (document[Form_HT2].email.value.match(/(\w+)@(.+)\.(\w+)$/) == null){
	  document[Form_HT2].email.focus();
	  document[Form_HT2].email.select();
	  alert('Endereço de email inválido !');
	}
	/*else if (document[Form_HT2].senha.value == ""){
	  document[Form_HT2].senha.focus();
	  alert('Informe uma senha !');
	}*/
	else{
	  document[Form_HT2].submit();
	}
}



function envia_form_list(Form_LST){
	if (document[Form_LST].id_presente_tipo.value == ""){
		document[Form_LST].id_presente_tipo.focus();
		alert('Informe corretamente um tipo de lista !');
	}
	else if (document[Form_LST].nome_lista.value == ""){
		document[Form_LST].nome_lista.focus();
		alert('Informe corretamente o nome da lista !');
	}
	else if (document[Form_LST].dia.value == "" || isNaN(document[Form_LST].dia.value)==true || document[Form_LST].dia.value > 31){
		document[Form_LST].dia.focus();
		alert('Informe corretamente um dia !');
	}
	else if (document[Form_LST].mes.value == "" || isNaN(document[Form_LST].mes.value)==true || document[Form_LST].mes.value > 12){
		document[Form_LST].mes.focus();
		alert('Informe corretamente um mês !');
	}
	else if (document[Form_LST].ano.value == "" || isNaN(document[Form_LST].ano.value)==true || document[Form_LST].ano.value < 2007){
		document[Form_LST].ano.focus();
		alert('Informe corretamente um ano !');
	}
	else if (document[Form_LST].nome.value == ""){
		document[Form_LST].nome.focus();
		alert('Informe corretamente o nome !');
	}
	else if (document[Form_LST].endereco.value == ""){
		document[Form_LST].endereco.focus();
		alert('Informe corretamente o endereco !');
	}
	else if (document[Form_LST].numero.value == "" || isNaN(document[Form_LST].numero.value)==true){
		document[Form_LST].numero.focus();
		alert('Informe corretamente o numero !');
	}
	else if (document[Form_LST].cep.value == ""){
		document[Form_LST].cep.focus();
		alert('Informe corretamente o cep !');
	}
	else if (document[Form_LST].bairro.value == ""){
		document[Form_LST].bairro.focus();
		alert('Informe corretamente o bairro !');
	}
	else if (document[Form_LST].cidade.value == ""){
		document[Form_LST].cidade.focus();
		alert('Informe corretamente a cidade !');
	}
	else if (document[Form_LST].uf.value == ""){
		document[Form_LST].uf.focus();
		alert('Informe corretamente o UF !');
	}
	else if (document[Form_LST].pais.value == ""){
		document[Form_LST].pais.focus();
		alert('Informe corretamente o pais !');
	}
	else{
		document[Form_LST].submit();
	}
}

function envia_form_SAC(Form_SAC){
	if (document[Form_SAC].nome.value == ""){
		document[Form_SAC].nome.focus();
		alert('Informe corretamente um nome !');
	}
	else if (document[Form_SAC].email.value.match(/(\w+)@(.+)\.(\w+)$/) == null){
	  document[Form_SAC].email.focus();
	  document[Form_SAC].email.select();
	  alert('Endereço de email inválido !');
	}
	else if (document[Form_SAC].telefone.value == ""){
		document[Form_SAC].telefone.focus();
		alert('Informe corretamente o telefone !');
	}
	else if (document[Form_SAC].cidade.value == ""){
		document[Form_SAC].cidade.focus();
		alert('Informe corretamente a cidade !');
	}
	else if (document[Form_SAC].estado.value == ""){
		document[Form_SAC].estado.focus();
		alert('Informe corretamente o estado !');
	}
	else if (document[Form_SAC].mensagem.value == ""){
		document[Form_SAC].mensagem.focus();
		alert('Digite corretamente uma mensagem !');
	}
	else{
		document[Form_SAC].submit();
	}
}

function envia_form_fornecedor(Form_FORNEC){
	if (document[Form_FORNEC].nome.value == ""){
		document[Form_FORNEC].nome.focus();
		alert('Informe corretamente um nome !');
	}
	else if (document[Form_FORNEC].empresa.value == ""){
		document[Form_FORNEC].empresa.focus();
		alert('Informe corretamente o nome da empresa !');
	}
	else if (document[Form_FORNEC].email.value.match(/(\w+)@(.+)\.(\w+)$/) == null){
	  document[Form_FORNEC].email.focus();
	  document[Form_FORNEC].email.select();
	  alert('Endereço de email inválido !');
	}
	else if (document[Form_FORNEC].telefone.value == ""){
		document[Form_FORNEC].telefone.focus();
		alert('Informe corretamente o telefone !');
	}
	else if (document[Form_FORNEC].cidade.value == ""){
		document[Form_FORNEC].cidade.focus();
		alert('Informe corretamente a cidade !');
	}
	else if (document[Form_FORNEC].estado.value == ""){
		document[Form_FORNEC].estado.focus();
		alert('Informe corretamente o estado !');
	}
	else if (document[Form_FORNEC].mensagem.value == ""){
		document[Form_FORNEC].mensagem.focus();
		alert('Digite corretamente uma mensagem !');
	}
	else{
		document[Form_FORNEC].submit();
	}
}

function envia_form_rh(Form_RH){
	if (document[Form_RH].nome.value == ""){
		document[Form_RH].nome.focus();
		alert('Informe corretamente um nome !');
	}
	else if (document[Form_RH].endereco.value == ""){
		document[Form_RH].endereco.focus();
		alert('Informe corretamente o endereço !');
	}
	else if (document[Form_RH].numero.value == "" || isNaN(document[Form_RH].numero.value)==true){
		document[Form_RH].numero.focus();
		alert('Informe corretamente o numero !');
	}
	else if (document[Form_RH].bairro.value == ""){
		document[Form_RH].bairro.focus();
		alert('Informe corretamente o bairro !');
	}
	else if (document[Form_RH].complemento.value == ""){
		document[Form_RH].complemento.focus();
		alert('Informe corretamente o complemento !');
	}
	else if (document[Form_RH].cidade.value == ""){
		document[Form_RH].cidade.focus();
		alert('Informe corretamente a cidade !');
	}
	else if (document[Form_RH].estado.value == ""){
		document[Form_RH].estado.focus();
		alert('Informe corretamente o estado !');
	}
	else if (document[Form_RH].email.value.match(/(\w+)@(.+)\.(\w+)$/) == null){
	  document[Form_RH].email.focus();
	  document[Form_RH].email.select();
	  alert('Endereço de email inválido !');
	}
	else if (document[Form_RH].telefone.value == ""){
		document[Form_RH].telefone.focus();
		alert('Informe corretamente o telefone !');
	}
	else if (document[Form_RH].sexo.value == ""){
		document[Form_RH].sexo.focus();
		alert('Informe corretamente o sexo !');
	}
	else if (document[Form_RH].dia.value == "" || isNaN(document[Form_RH].dia.value)==true || document[Form_RH].dia.value > 31){
		document[Form_RH].dia.focus();
		alert('Informe corretamente um dia !');
	}
	else if (document[Form_RH].mes.value == "" || isNaN(document[Form_RH].mes.value)==true || document[Form_RH].mes.value > 12){
		document[Form_RH].mes.focus();
		alert('Informe corretamente um mês !');
	}
	else if (document[Form_RH].ano.value == "" || isNaN(document[Form_RH].ano.value)==true || document[Form_RH].ano.value < 1900){
		document[Form_RH].ano.focus();
		alert('Informe corretamente um ano !');
	}
	else{
		document[Form_RH].submit();
	}
}

function envia_consulta(Form_HIST,valor){
	if (valor==1){
		document[Form_HIST].numero_pedido.style.background='#efefef';
		document[Form_HIST].numero_pedido.disabled=false;
		
		if (document[Form_HIST].numero_pedido.value == "" || isNaN(document[Form_HIST].numero_pedido.value)==true){
		document[Form_HIST].numero_pedido.focus();
		alert('Informe corretamente o numero de seu pedido !');
		}
		else{
		document[Form_HIST].submit();
		}
	}
	else if (valor==2){
		if (document[Form_HIST].imes.value == "" || document[Form_HIST].iano.value == "" || document[Form_HIST].dmes.value == "" || document[Form_HIST].dano.value == ""){
		alert('Informe corretamente a data de sua consulta !');
		}
		else{
		document[Form_HIST].submit();
		}
	}
	else{
		document[Form_HIST].submit();
	}
}

function AtiHist(valor){
	if (valor==0){
		document.consulta_hist.numero_pedido.style.background='#DCDCDC';
		document.consulta_hist.numero_pedido.disabled=true;
		document.consulta_hist.imes.style.background='#DCDCDC';
		document.consulta_hist.imes.disabled=true;
		document.consulta_hist.iano.style.background='#DCDCDC';
		document.consulta_hist.iano.disabled=true;
		document.consulta_hist.dmes.style.background='#DCDCDC';
		document.consulta_hist.dmes.disabled=true;
		document.consulta_hist.dano.style.background='#DCDCDC';
		document.consulta_hist.dano.disabled=true;
	}else if (valor==1){
		document.consulta_hist.numero_pedido.style.background='#EFEFEF';
		document.consulta_hist.numero_pedido.disabled=false;
		document.consulta_hist.imes.style.background='#DCDCDC';
		document.consulta_hist.imes.disabled=true;
		document.consulta_hist.iano.style.background='#DCDCDC';
		document.consulta_hist.iano.disabled=true;
		document.consulta_hist.dmes.style.background='#DCDCDC';
		document.consulta_hist.dmes.disabled=true;
		document.consulta_hist.dano.style.background='#DCDCDC';
		document.consulta_hist.dano.disabled=true;
	}else if (valor==2){
		document.consulta_hist.numero_pedido.style.background='#DCDCDC';
		document.consulta_hist.numero_pedido.disabled=true;
		document.consulta_hist.imes.style.background='#EFEFEF';
		document.consulta_hist.imes.disabled=false;
		document.consulta_hist.iano.style.background='#EFEFEF';
		document.consulta_hist.iano.disabled=false;
		document.consulta_hist.dmes.style.background='#EFEFEF';
		document.consulta_hist.dmes.disabled=false;
		document.consulta_hist.dano.style.background='#EFEFEF';
		document.consulta_hist.dano.disabled=false;
	}
	document.consulta_hist.num.value=valor;
}

function checa_cpf_heth(CPF) {
	var msg = true;
	if (CPF.length != 11 || CPF == "00000000000" || CPF == "11111111111" ||
	  CPF == "22222222222" ||	CPF == "33333333333" || CPF == "44444444444" ||
	  CPF == "55555555555" || CPF == "66666666666" || CPF == "77777777777" ||
	  CPF == "88888888888" || CPF == "99999999999")
	msg = false;
	soma = 0;
	for (y=0; y < 9; y ++)
	soma += parseInt(CPF.charAt(y)) * (10 - y);
	resto = 11 - (soma % 11);
	if (resto == 10 || resto == 11)resto = 0;
	if (resto != parseInt(CPF.charAt(9)))
	  msg = false; soma = 0;
	for (y = 0; y < 10; y ++)
	  soma += parseInt(CPF.charAt(y)) * (11 - y);
	resto = 11 - (soma % 11);
	if (resto == 10 || resto == 11) resto = 0;
	if (resto != parseInt(CPF.charAt(10)))
	  msg = false;
	return msg;
}

function checa_cnpj_heth(s) {
	var msg = true;
	var y;
	var c = s.substr(0,12);
	var dv = s.substr(12,2);
	var d1 = 0;
	for (y = 0; y < 12; y++)
	{
	d1 += c.charAt(11-y)*(2+(y % 8));
	}
	if (d1 == 0) msg = false;
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(0) != d1)msg = false;
	d1 *= 2;
	for (y = 0; y < 12; y++)
	{
	d1 += c.charAt(11-y)*(2+((y+1) % 8));
	}
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(1) != d1) msg = false;
	return msg;
}

function dataproximo(de, para){
	if (de.length == 2){
		para.focus();
	}
}
function campoCEP(valor){
	if (valor.value.length == 5){
		valor.value=valor.value+'-';
	}
}
function campoTEL(valor){
	if (valor.value.length == 4){
		valor.value=valor.value+'-';
	}
}
//-->