// JavaScript Document

function valida(theForm){

	

	var msgErro = document.getElementById("msgErro");

	msgErro.innerHTML = "";

	msgErro.className = "";

	

	var nome = document.getElementById("nome");

	if (theForm.nome.value == ""){

		nome.style.color = "#CC0000";

		theForm.nome.focus();

		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos obrigatorios";

		msgErro.className = "erro";

		return (false);

	}else{

		nome.style.color = "#000000";	

	}

	

//validar email

//validar email
var email = document.getElementById("email");
	if (theForm.email.value == ""){
		email.style.color = "#CC0000";
		theForm.email.focus();
		msgErro.innerHTML = "Por favor, digite seu e-mail";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#666666";	
	}
	
	var email = document.getElementById("email");
	var filtro=/^.+@.+\..{2,3}$/;
	if (filtro.test(theForm.email.value) == false){
		email.style.color = "#CC0000";
		theForm.email.focus();
		msgErro.innerHTML = "E-mail inválido";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#666666";	
	}

	

	

	var ddd = document.getElementById("ddd");

	if (theForm.ddd.value == ""){

		ddd.style.color = "#CC0000";

		theForm.ddd.focus();

		msgErro.innerHTML = "Por favor, digite seu DDD.";

		msgErro.className = "erro";

		return (false);

	}else{

		ddd.style.color = "#CC0000";	

	}

	

	var fone = document.getElementById("fone");

	if (theForm.fone.value == ""){

		ddd.style.color = "#CC0000";

		theForm.fone.focus();

		msgErro.innerHTML = "Por favor, digite seu Telefone.";

		msgErro.className = "erro";

		return (false);

	}else{

		fone.style.color = "#CC0000";	

	}

	var msg = document.getElementById("msg");

	if (theForm.msg.value == ""){

		msg.style.color = "#CC0000";

		theForm.msg.focus();

		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos obrigatorios.";

		msgErro.className = "erro";

		return (false);

	}else{

		msg.style.color = "#CC0000";	

	}

}



<!--

function FrontPage_Form1_Validator(theForm)

{



if (theForm.cepDest.value == "")

  {

    alert("Por favor, digite seu CEP correto.");

    theForm.cepDest.focus();

    return (false);

  }



  if (theForm.cepDest.value.length < 8)

  {

    alert("Por favor, digite seu CEP correto.");

    theForm.cepDest.focus();

    return (false);

  }



}

//-->





function valida_orc(theForm){

	

	var msgErro = document.getElementById("msgErro");

	msgErro.innerHTML = "";

	msgErro.className = "";

	

	var nome = document.getElementById("nome");

	if (theForm.nome.value == ""){

		nome.style.color = "#CC0000";

		theForm.nome.focus();

		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos obrigatorios";

		msgErro.className = "erro";

		return (false);

	}else{

		nome.style.color = "#000000";	

	}

	

//validar email

//validar email
var email = document.getElementById("email");
	if (theForm.email.value == ""){
		email.style.color = "#CC0000";
		theForm.email.focus();
		msgErro.innerHTML = "Por favor, digite seu e-mail";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#666666";	
	}
	
	var email = document.getElementById("email");
	var filtro=/^.+@.+\..{2,3}$/;
	if (filtro.test(theForm.email.value) == false){
		email.style.color = "#CC0000";
		theForm.email.focus();
		msgErro.innerHTML = "E-mail inválido";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#666666";	
	}

	

	

	var ddd = document.getElementById("ddd");

	if (theForm.ddd.value == ""){

		ddd.style.color = "#CC0000";

		theForm.ddd.focus();

		msgErro.innerHTML = "Por favor, digite seu DDD.";

		msgErro.className = "erro";

		return (false);

	}else{

		ddd.style.color = "#CC0000";	

	}

	

	var fone = document.getElementById("fone");

	if (theForm.fone.value == ""){

		ddd.style.color = "#CC0000";

		theForm.fone.focus();

		msgErro.innerHTML = "Por favor, digite seu Telefone.";

		msgErro.className = "erro";

		return (false);

	}else{

		fone.style.color = "#CC0000";	

	}
	
	
	
	

	/*var cidade = document.getElementById("cidade");

	if (theForm.cidade.value == ""){

		cidade.style.color = "#CC0000";

		theForm.cidade.focus();

		msgErro.innerHTML = "Por favor, digite a sua cidade.";

		msgErro.className = "erro";

		return (false);

	}else{

		cidade.style.color = "#CC0000";	

	}

	var estado = document.getElementById("estado");

	if (theForm.estado.value == "0"){

		cidade.style.color = "#CC0000";

		theForm.estado.focus();

		msgErro.innerHTML = "Por favor, digite o seu estado.";

		msgErro.className = "erro";

		return (false);

	}else{

		cidade.style.color = "#CC0000";	

	}

	

	var vencimento = document.getElementById("vencimento");

	if (theForm.vencimento.value == ""){

		vencimento.style.color = "#CC0000";

		theForm.vencimento.focus();

		msgErro.innerHTML = "Por favor, digite o vencimento do seu seguro.";

		msgErro.className = "erro";

		return (false);

	}else{

		vencimento.style.color = "#CC0000";	

	}

	var seguradora = document.getElementById("seguradora");

	if (theForm.seguradora.value == ""){

		seguradora.style.color = "#CC0000";

		theForm.seguradora.focus();

		msgErro.innerHTML = "Por favor, digite a sua seguradora.";

		msgErro.className = "erro";

		return (false);

	}else{

		seguradora.style.color = "#CC0000";	

	}*/

	var veiculo = document.getElementById("veiculo");

	if (theForm.veiculo.value == ""){

		veiculo.style.color = "#CC0000";

		theForm.veiculo.focus();

		msgErro.innerHTML = "Por favor, digite a marca e o modelo do seu veículo.";

		msgErro.className = "erro";

		return (false);

	}else{

		veiculo.style.color = "#CC0000";	

	}

}



<!--

function FrontPage_Form1_Validator(theForm)

{



if (theForm.cepDest.value == "")

  {

    alert("Por favor, digite seu CEP correto.");

    theForm.cepDest.focus();

    return (false);

  }



  if (theForm.cepDest.value.length < 8)

  {

    alert("Por favor, digite seu CEP correto.");

    theForm.cepDest.focus();

    return (false);

  }



}





function valida_orc2(theForm){

	

	var msgErro = document.getElementById("msgErro");

	msgErro.innerHTML = "";

	msgErro.className = "";

	

	var nome = document.getElementById("nome");

	if (theForm.nome.value == ""){

		nome.style.color = "#CC0000";

		theForm.nome.focus();

		msgErro.innerHTML = "Por favor, verifique o preencimento dos campos obrigatorios";

		msgErro.className = "erro";

		return (false);

	}else{

		nome.style.color = "#000000";	

	}

	

//validar email

//validar email
var email = document.getElementById("email");
	if (theForm.email.value == ""){
		email.style.color = "#CC0000";
		theForm.email.focus();
		msgErro.innerHTML = "Por favor, digite seu e-mail";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#666666";	
	}
	
	var email = document.getElementById("email");
	var filtro=/^.+@.+\..{2,3}$/;
	if (filtro.test(theForm.email.value) == false){
		email.style.color = "#CC0000";
		theForm.email.focus();
		msgErro.innerHTML = "E-mail inválido";
		msgErro.className = "erro";
		return (false);
	}else{
		email.style.color = "#666666";	
	}

	

	

	var ddd = document.getElementById("ddd");

	if (theForm.ddd.value == ""){

		ddd.style.color = "#CC0000";

		theForm.ddd.focus();

		msgErro.innerHTML = "Por favor, digite seu DDD.";

		msgErro.className = "erro";

		return (false);

	}else{

		ddd.style.color = "";	

	}

	

	var fone = document.getElementById("fone");

	if (theForm.fone.value == ""){

		fone.style.color = "#CC0000";

		theForm.fone.focus();

		msgErro.innerHTML = "Por favor, digite seu Telefone.";

		msgErro.className = "erro";

		return (false);

	}else{

		fone.style.color = "";	

	}

	var cidade = document.getElementById("cidade");

	if (theForm.cidade.value == ""){

		cidade.style.color = "#CC0000";

		theForm.cidade.focus();

		msgErro.innerHTML = "Por favor, digite a sua cidade.";

		msgErro.className = "erro";

		return (false);

	}else{

		cidade.style.color = "";	

	}

	var estado = document.getElementById("estado");

	if (theForm.estado.value == "0"){

		cidade.style.color = "#CC0000";

		theForm.estado.focus();

		msgErro.innerHTML = "Por favor, digite o seu estado.";

		msgErro.className = "erro";

		return (false);

	}else{

		cidade.style.color = "";	

	}

	var cep = document.getElementById("cep");

	if (theForm.cep.value == ""){

		cep.style.color = "#CC0000";

		theForm.cep.focus();

		msgErro.innerHTML = "Por favor, digite o seu CEP.";

		msgErro.className = "erro";

		return (false);

	}else{

		cep.style.color = "";	

	}
	
	
	
	
	var rg = document.getElementById("rg");

	if (theForm.rg.value == ""){

		rg.style.color = "#CC0000";

		theForm.rg.focus();

		msgErro.innerHTML = "Por favor, digite seu RG.";

		msgErro.className = "erro";

		return (false);

	}else{

		rg.style.color = "#CC0000";	

	}
	
	
	
	
	var cpf = document.getElementById("cpf");

	if (theForm.cpf.value == ""){

		cpf.style.color = "#CC0000";

		theForm.cpf.focus();

		msgErro.innerHTML = "Por favor, digite seu CPF.";

		msgErro.className = "erro";

		return (false);

	}else{

		cpf.style.color = "#CC0000";	

	}
	
	
	

	var data_nasc1 = document.getElementById("data_nasc1");

	if (theForm.data_nasc1.value == "0"){

		data_nasc1.style.color = "#CC0000";

		theForm.data_nasc1.focus();

		msgErro.innerHTML = "Por favor, preencha sua data de nascimento correto.";

		msgErro.className = "erro";

		return (false);

	}else{

		data_nasc1.style.color = "";	

	}

	var data_nasc2 = document.getElementById("data_nasc2");

	if (theForm.data_nasc2.value == "0"){

		data_nasc1.style.color = "#CC0000";

		theForm.data_nasc2.focus();

		msgErro.innerHTML = "Por favor, preencha sua data de nascimento correto.";

		msgErro.className = "erro";

		return (false);

	}else{

		data_nasc2.style.color = "";	

	}

	var data_nasc3 = document.getElementById("data_nasc3");

	if (theForm.data_nasc3.value == "0"){

		data_nasc1.style.color = "#CC0000";

		theForm.data_nasc3.focus();

		msgErro.innerHTML = "Por favor, preencha sua data de nascimento correto.";

		msgErro.className = "erro";

		return (false);

	}else{

		data_nasc3.style.color = "";	

	}

	

	var sexo = document.getElementById("sexo");

	if (theForm.sexo.value == "0"){

		sexo.style.color = "#CC0000";

		theForm.sexo.focus();

		msgErro.innerHTML = "Por favor, digite o seu sexo.";

		msgErro.className = "erro";

		return (false);

	}else{

		sexo.style.color = "";	

	}

	var estado_civil = document.getElementById("estado_civil");

	if (theForm.estado_civil.value == "0"){

		estado_civil.style.color = "#CC0000";

		theForm.estado_civil.focus();

		msgErro.innerHTML = "Por favor, digite o seu estado civil.";

		msgErro.className = "erro";

		return (false);

	}else{

		estado_civil.style.color = "";	

	}

	var trabalha = document.getElementById("trabalha");

	if (theForm.trabalha.value == "0"){

		trabalha.style.color = "#CC0000";

		theForm.trabalha.focus();

		msgErro.innerHTML = "Por favor, escolha uma op&ccedil;&atilde;o no 'trabalha'.";

		msgErro.className = "erro";

		return (false);

	}else{

		trabalha.style.color = "";	

	}

	var estuda = document.getElementById("estuda");

	if (theForm.estuda.value == "0"){

		estuda.style.color = "#CC0000";

		theForm.estuda.focus();

		msgErro.innerHTML = "Por favor, escolha um op&ccedil; no 'estuda'.";

		msgErro.className = "erro";

		return (false);

	}else{

		estuda.style.color = "";	

	}

	var mora_em = document.getElementById("mora_em");

	if (theForm.mora_em.value == "0"){

		mora_em.style.color = "#CC0000";

		theForm.mora_em.focus();

		msgErro.innerHTML = "Por favor, escolha um op&ccedil; no 'mora em'.";

		msgErro.className = "erro";

		return (false);

	}else{

		mora_em.style.color = "";	

	}

	var moradia = document.getElementById("moradia");

	if (theForm.moradia.value == "0"){

		moradia.style.color = "#CC0000";

		theForm.moradia.focus();

		msgErro.innerHTML = "Por favor, escolha um op&ccedil; no 'moradia'.";

		msgErro.className = "erro";

		return (false);

	}else{

		moradia.style.color = "";	

	}

	

	var marca_veiculo = document.getElementById("marca_veiculo");

	if (theForm.marca_veiculo.value == ""){

		marca_veiculo.style.color = "#CC0000";

		theForm.marca_veiculo.focus();

		msgErro.innerHTML = "Por favor, digite a marca do ve&iacute;culo.";

		msgErro.className = "erro";

		return (false);

	}else{

		marca_veiculo.style.color = "";	

	}

	var modelo_veiculo = document.getElementById("modelo_veiculo");

	if (theForm.modelo_veiculo.value == ""){

		modelo_veiculo.style.color = "#CC0000";

		theForm.modelo_veiculo.focus();

		msgErro.innerHTML = "Por favor, digite o modelo do ve&iacute;culo.";

		msgErro.className = "erro";

		return (false);

	}else{

		modelo_veiculo.style.color = "";	

	}

	var ano_fab = document.getElementById("ano_fab");

	if (theForm.ano_fab.value == ""){

		ano_fab.style.color = "#CC0000";

		theForm.ano_fab.focus();

		msgErro.innerHTML = "Por favor, digite o ano de fabrica&ccedil; do ve&iacute;culo.";

		msgErro.className = "erro";

		return (false);

	}else{

		ano_fab.style.color = "";	

	}

	var ano_mod = document.getElementById("ano_mod");

	if (theForm.ano_mod.value == ""){

		ano_mod.style.color = "#CC0000";

		theForm.ano_mod.focus();

		msgErro.innerHTML = "Por favor, digite o ano do modelo do ve&iacute;culo.";

		msgErro.className = "erro";

		return (false);

	}else{

		ano_mod.style.color = "";	

	}

	var portas = document.getElementById("portas");

	if (theForm.portas.value == "0"){

		portas.style.color = "#CC0000";

		theForm.portas.focus();

		msgErro.innerHTML = "Por favor, digite quantas portas tem o ve&iacute;culo.";

		msgErro.className = "erro";

		return (false);

	}else{

		portas.style.color = "";	

	}

	var combustivel = document.getElementById("combustivel");

	if (theForm.combustivel.value == "0"){

		combustivel.style.color = "#CC0000";

		theForm.combustivel.focus();

		msgErro.innerHTML = "Por favor, digite o combustivel do ve&iacute;culo.";

		msgErro.className = "erro";

		return (false);

	}else{

		combustivel.style.color = "";	

	}

	var kit_gas = document.getElementById("kit_gas");

	if (theForm.kit_gas.value == "0"){

		kit_gas.style.color = "#CC0000";

		theForm.kit_gas.focus();

		msgErro.innerHTML = "Por favor, digite se possui kit gas.";

		msgErro.className = "erro";

		return (false);

	}else{

		kit_gas.style.color = "";	

	}

	var alienado = document.getElementById("alienado");

	if (theForm.alienado.value == "0"){

		alienado.style.color = "#CC0000";

		theForm.alienado.focus();

		msgErro.innerHTML = "Por favor, digite se o ve&iacute;culo é alienado.";

		msgErro.className = "erro";

		return (false);

	}else{

		alienado.style.color = "";	

	}

}



//MÁSCARA DE VALORES

function txtBoxFormat(objeto, sMask, evtKeyPress) {

var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

if(document.all) { // Internet Explorer

nTecla = evtKeyPress.keyCode; }

else if(document.layers) { // Nestcape

nTecla = evtKeyPress.which;

}

sValue = objeto.value;

// Limpa todos os caracteres de formatação que

// já estiverem no campo.

sValue = sValue.toString().replace( "-", "" );

sValue = sValue.toString().replace( "-", "" );

sValue = sValue.toString().replace( ".", "" );

sValue = sValue.toString().replace( ".", "" );

sValue = sValue.toString().replace( "/", "" );

sValue = sValue.toString().replace( "/", "" );

sValue = sValue.toString().replace( ":", "" );

sValue = sValue.toString().replace( ":", "" );

sValue = sValue.toString().replace( "(", "" );

sValue = sValue.toString().replace( "(", "" );

sValue = sValue.toString().replace( ")", "" );

sValue = sValue.toString().replace( ")", "" );

sValue = sValue.toString().replace( " ", "" );

sValue = sValue.toString().replace( " ", "" );

fldLen = sValue.length;

mskLen = sMask.length;

i = 0;

nCount = 0;

sCod = "";

mskLen = fldLen;

while (i <= mskLen) {

bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))

bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

if (bolMask) {

sCod += sMask.charAt(i);

mskLen++; }

else {

sCod += sValue.charAt(nCount);

nCount++;

}

i++;

}

objeto.value = sCod;

if (nTecla != 8) { // backspace

if (sMask.charAt(i-1) == "9") { // apenas números...

return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9

else { // qualquer caracter...

return true;

} }

else {

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);
  }

}