//CAMPOS EM CAMPOS
function CamposEmCampos(marca,modelo,ano,placa,valorveiculo,valorentrada,valorfinanciado,parcelas,pessoa,nomerazao,cpfcnpj,rg,orgaoemissor,uf,dataemissao,datanascimento,naturalidade,ufnas,sexo,nomedopai,nomedamae,estadocivil,enderecocorrespondencia,graudeinstrucao,dependentes,enderecoresidencial,numeroresidencial,complementoresidencial,bairroresidencial,cidaderesidencial,cepresidencial,uf1,temporesidencialano,temporesidencialmes,tiporesidencia,telefoneresidencial,tipotelefone,celularresidencial,empresa,cnpjempresapropria,dataadmissao,renda,rendaextra,rendaextraorigem,cargofuncao,enderecocomercial,numerocomercial,complementocomercial,bairrocomercial,cidadecomercial,cepcomercial,uf2,telefonecomercial,empresaanterior,empresaanteriortelefone,tempoempresaano,tempoempresames,nomeconjuge,celularconjuge,cpfconjuge,rgconjuge,nascimentoconjuge,empresaconjuge,telefoneconjuge,ocupacaoconjuge,rendaconjuge,nomereferencia1,enderecoreferencia1,numeroreferencia1,complementoreferencia1,telefonereferencia1,nomereferencia2,enderecoreferencia2,numeroreferencia2,complementoreferencia2,telefonereferencia2,cartoes,outroscartoes,banco1,tipoconta1,agencia1,conta1,tempocontaanos1,tempocontameses1,banco2,tipoconta2,agencia2,conta2,tempocontaanos2,tempocontameses2,tipoimovel,cidadeuf,valorimovel,marcaveiculo,anoveiculo,valorveiculo1)
{
	financiamento.marca.value = marca;
	financiamento.modelo.value = modelo;
	financiamento.ano.value = ano;
	financiamento.placa.value = placa;
	financiamento.valorveiculo.value = valorveiculo;
	financiamento.valorentrada.value = valorentrada;
	financiamento.valorfinanciado.value = valorfinanciado;
	
	var i = financiamento.parcelas.options.length;
	while (i--)
		if (financiamento.parcelas.options[i].getAttribute("value") == parcelas)
			break;
	financiamento.parcelas.selectedIndex = i;	
	
	var i = financiamento.pessoa.options.length;
	while (i--)
		if (financiamento.pessoa.options[i].getAttribute("value") == pessoa)
			break;
	financiamento.pessoa.selectedIndex = i;
	
	financiamento.nomerazao.value = nomerazao;
	financiamento.cpfcnpj.value = cpfcnpj;
	financiamento.rg.value = rg;
	financiamento.orgaoemissor.value = orgaoemissor;
	
	var i = financiamento.uf.options.length;
	while (i--)
		if (financiamento.uf.options[i].getAttribute("value") == uf)
			break;
	financiamento.uf.selectedIndex = i;
	
	financiamento.dataemissao.value = dataemissao;
	financiamento.datanascimento.value = datanascimento;
	financiamento.naturalidade.value = naturalidade;
	
	var i = financiamento.ufnas.options.length;
	while (i--)
		if (financiamento.ufnas.options[i].getAttribute("value") == ufnas)
			break;
	financiamento.ufnas.selectedIndex = i;
	
	
	var i = financiamento.sexo.options.length;
	while (i--)
		if (financiamento.sexo.options[i].getAttribute("value") == sexo)
			break;
	financiamento.sexo.selectedIndex = i;
	
	financiamento.nomedopai.value = nomedopai;
	financiamento.nomedamae.value = nomedamae;
	
	var i = financiamento.estadocivil.options.length;
	while (i--)
		if (financiamento.estadocivil.options[i].getAttribute("value") == estadocivil)
			break;
	financiamento.estadocivil.selectedIndex = i;
	
	var i = financiamento.enderecocorrespondencia.options.length;
	while (i--)
		if (financiamento.enderecocorrespondencia.options[i].getAttribute("value") == enderecocorrespondencia)
			break;
	financiamento.enderecocorrespondencia.selectedIndex = i;
	
	var i = financiamento.graudeinstrucao.options.length;
	while (i--)
		if (financiamento.graudeinstrucao.options[i].getAttribute("value") == graudeinstrucao)
			break;
	financiamento.graudeinstrucao.selectedIndex = i;	
	
	financiamento.dependentes.value = dependentes;
	financiamento.enderecoresidencial.value = enderecoresidencial;
	financiamento.numeroresidencial.value = numeroresidencial;
	financiamento.complementoresidencial.value = complementoresidencial;
	financiamento.bairroresidencial.value = bairroresidencial;
	financiamento.cidaderesidencial.value = cidaderesidencial;
	financiamento.cepresidencial.value = cepresidencial;
	
	var i = financiamento.uf1.options.length;
	while (i--)
		if (financiamento.uf1.options[i].getAttribute("value") == uf1)
			break;
	financiamento.uf1.selectedIndex = i;
	
	financiamento.temporesidencialano.value = temporesidencialano;
	financiamento.temporesidencialmes.value = temporesidencialmes;
	
	var i = financiamento.tiporesidencia.options.length;
	while (i--)
		if (financiamento.tiporesidencia.options[i].getAttribute("value") == tiporesidencia)
			break;
	financiamento.tiporesidencia.selectedIndex = i;
	
	financiamento.telefoneresidencial.value = telefoneresidencial;
	
	var i = financiamento.tipotelefone.options.length;
	while (i--)
		if (financiamento.tipotelefone.options[i].getAttribute("value") == tipotelefone)
			break;
	financiamento.tipotelefone.selectedIndex = i;
	
	financiamento.celularresidencial.value = celularresidencial;
	financiamento.empresa.value = empresa;
	financiamento.cnpjempresapropria.value = cnpjempresapropria;
	financiamento.dataadmissao.value = dataadmissao;
	financiamento.renda.value = renda;
	financiamento.rendaextra.value = rendaextra;
	financiamento.rendaextraorigem.value = rendaextraorigem;
	financiamento.cargofuncao.value = cargofuncao;
	financiamento.enderecocomercial.value = enderecocomercial;
	financiamento.numerocomercial.value = numerocomercial;
	financiamento.complementocomercial.value = complementocomercial;
	financiamento.bairrocomercial.value = bairrocomercial;
	financiamento.cidadecomercial.value = cidadecomercial;
	financiamento.cepcomercial.value = cepcomercial;
	
	var i = financiamento.uf2.options.length;
	while (i--)
		if (financiamento.uf2.options[i].getAttribute("value") == uf2)
			break;
	financiamento.uf2.selectedIndex = i;
	
	financiamento.telefonecomercial.value = telefonecomercial;
	financiamento.empresaanterior.value = empresaanterior;
	financiamento.empresaanteriortelefone.value = empresaanteriortelefone;
	financiamento.tempoempresaano.value = tempoempresaano;
	financiamento.tempoempresames.value = tempoempresames;
	financiamento.nomeconjuge.value = nomeconjuge;
	financiamento.celularconjuge.value = celularconjuge;
	financiamento.cpfconjuge.value = cpfconjuge;
	financiamento.rgconjuge.value = rgconjuge;
	financiamento.nascimentoconjuge.value = nascimentoconjuge;
	financiamento.empresaconjuge.value = empresaconjuge;
	financiamento.telefoneconjuge.value = telefoneconjuge;
	financiamento.ocupacaoconjuge.value = ocupacaoconjuge;
	financiamento.rendaconjuge.value = rendaconjuge;
	financiamento.nomereferencia1.value = nomereferencia1;
	financiamento.enderecoreferencia1.value = enderecoreferencia1;
	financiamento.numeroreferencia1.value = numeroreferencia1;
	financiamento.complementoreferencia1.value = complementoreferencia1;
	financiamento.telefonereferencia1.value = telefonereferencia1;
	financiamento.nomereferencia2.value = nomereferencia2;
	financiamento.enderecoreferencia2.value = enderecoreferencia2;
	financiamento.numeroreferencia2.value = numeroreferencia2;
	financiamento.complementoreferencia2.value = complementoreferencia2;
	financiamento.telefonereferencia2.value = telefonereferencia2;
	
	var i = financiamento.cartoes.options.length;
	while (i--)
		if (financiamento.cartoes.options[i].getAttribute("value") == cartoes)
			break;
	financiamento.cartoes.selectedIndex = i;
	
	financiamento.outroscartoes.value = outroscartoes;
	financiamento.banco1.value = banco1;
	
	var i = financiamento.tipoconta1.options.length;
	while (i--)
		if (financiamento.tipoconta1.options[i].getAttribute("value") == tipoconta1)
			break;
	financiamento.tipoconta1.selectedIndex = i;	
	
	financiamento.agencia1.value = agencia1;
	financiamento.conta1.value = conta1;
	financiamento.tempocontaanos1.value = tempocontaanos1;
	financiamento.tempocontameses1.value = tempocontameses1;
	financiamento.banco2.value = banco2;
	
	var i = financiamento.tipoconta2.options.length;
	while (i--)
		if (financiamento.tipoconta2.options[i].getAttribute("value") == tipoconta2)
			break;
	financiamento.tipoconta2.selectedIndex = i;
	
	financiamento.agencia2.value = agencia2;
	financiamento.conta2.value = conta2;
	financiamento.tempocontaanos2.value = tempocontaanos2;
	financiamento.tempocontameses2.value = tempocontameses2;
	financiamento.tipoimovel.value = tipoimovel;
	financiamento.cidadeuf.value = cidadeuf;
	financiamento.valorimovel.value = valorimovel;
	financiamento.marcaveiculo.value = marcaveiculo;
	financiamento.anoveiculo.value = anoveiculo;
	financiamento.valorveiculo1.value = valorveiculo1;

}
//CAPTCHA
function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}
//BANNER LATERAL FLASH
function aberto()
{
 document.getElementById("banner").style.clip="rect(0px,790px,410px,0px)";
 document.getElementById("banner").style.marginLeft="-535px";
 document.getElementById("flash").style.marginLeft="0px";
}
//BANNER LATERAL FLASH
function fechado(){
 document.getElementById("banner").style.marginLeft="0px";
 document.getElementById("flash").style.marginLeft="-535px";
 document.getElementById("banner").style.width="0px";
}
function cpfOUcnpj(theElement, keypress)
{
	if (theElement.value.length <= 10)
		mascaraCPF(keypress,theElement);
	if (theElement.value.length > 11)
		alert('cnpj');
}
function mascaracnpj(keypress,theElement)
{
	campo = eval(theElement);
	
	separador1 = '.';
	separador2 = '-';
	separador3 = '/';
	conjunto1 = 3;
	conjunto2 = 7;	
	conjunto3 = 11;
	conjunto4 = 16;
	
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.length == conjunto1 || campo.value.length == conjunto2)
			campo.value = campo.value + separador1;
		if (campo.value.length == conjunto3)
			campo.value = campo.value + separador3;
		if (campo.value.length == conjunto4)
			campo.value = campo.value + separador2;
		return true;
	}
	else
		return false;
}
function verificacampos(theForm)
{
	if (theForm.revenda.value == '')
	{
		alert('Informe a revenda!');
		theForm.revenda.focus();
		return false;
	}
	if (theForm.cnpj.value == '')
	{
		alert('Informe o cnpj!');
		theForm.cnpj.focus();
		return false;
	}
	if (theForm.razaosocial.value == '')
	{
		alert('Informe a razão social!');
		theForm.razaosocial.focus();
		return false;
	}
	if (theForm.responsavel.value == '')
	{
		alert('Informe o responsável!');
		theForm.responsavel.focus();
		return false;
	}
	if (theForm.endereco.value == '')
	{
		alert('Informe o endereço!');
		theForm.endereco.focus();
		return false;
	}
	if (theForm.cep.value == '')
	{
		alert('Informe o cep!');
		theForm.cep.focus();
		return false;
	}
	if (theForm.cidade.value == '')
	{
		alert('Informe a cidade!');
		theForm.cidade.focus();
		return false;
	}
	if (theForm.estado.value == '')
	{
		alert('Informe o estado!');
		theForm.estado.focus();
		return false;
	}
	if (theForm.telefone.value == '')
	{
		alert('Informe o telefone!');
		theForm.telefone.focus();
		return false;
	}	
	if (theForm.email.value == '')
	{
		alert('Informe o email!');
		theForm.email.focus();
		return false;
	}
	return true;
}
function verificaSubmitContatar(theForm)
{
	if (theForm.titulo.value == '')
	{
		alert('Digite o título!');
		theForm.titulo.focus();
		return false;
	}
	if (theForm.mensagem.value == '')
	{
		alert('Digite a mensagem!');
		theForm.mensagem.focus();
		return false;
	}
	
	if(theForm.revenda.selectedIndex == 0)
	{
		return confirm('A mensagem é para todas as revendas?');
	}
	return true;
}
function verificaChamado(theForm)
{
	var passa = false;
	for(var x = 0; x < theForm.opiniao.length; x ++)
	{
		if(theForm.opiniao[x].checked)
		{
			passa = true;
			break;
		}
	}
	if (!passa)
	{
		alert('Escolha uma situação!');
		return false;
	}
	if (!verificaEmail(theForm))
		return false;
	if (theForm.contato.value == '')
	{
		alert('Digite o nome do contato!');
		theForm.contato.focus();
		return false;
	}
	if (theForm.mensagem.value == '')
	{
		alert('Digite a mensagem!');
		theForm.mensagem.focus();
		return false;
	}
	return true;
}

function ManageTabPanelDisplay1() {//telefone

var idlist = new Array('tab1focus','tab1ready','content1');

// No other customizations are necessary.
if(arguments.length < 1) { return; }
for(var i = 0; i < idlist.length; i++) {
   var block = false;
   for(var ii = 0; ii < arguments.length; ii++) {
      if(idlist[i] == arguments[ii]) {
         block = true;
         break;
         }
      }
   if(block) { document.getElementById(idlist[i]).style.display = "block"; }
   else { document.getElementById(idlist[i]).style.display = "none"; }
   }
}
function ManageTabPanelDisplay() {

var idlist = new Array('tab1focus','tab2focus','tab3focus','tab4focus','tab5focus','tab6focus','tab1ready','tab2ready','tab3ready','tab4ready','tab5ready','tab6ready','content1','content2','content3','content4','content5','content6');

// No other customizations are necessary.
if(arguments.length < 1) { return; }
for(var i = 0; i < idlist.length; i++) {
   var block = false;
   for(var ii = 0; ii < arguments.length; ii++) {
      if(idlist[i] == arguments[ii]) {
         block = true;
         break;
         }
      }
   if(block) { document.getElementById(idlist[i]).style.display = "block"; }
   else { document.getElementById(idlist[i]).style.display = "none"; }
   }
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

function mudaLink(destino)
{
	link = 'javascript:Janela(\'' + destino + '\',\'foto\',640,600);';
	document.getElementById('link_foto').href = link;
}
function addBookmark()
{
	if (document.all)
		window.external.AddFavorite(document.location,document.title);
}
function redireciona()
{
	window.location = "index.asp";
}
function startupload(progressID)
{
	Janela("progress.asp?progressid="+progressID,null,410,200);
}
function Janela(theURL,winName,w,h)
{
	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;
	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=0,resizable=0,location=0";
	features += ",menubar=0,toolbar=0,status=0";
	window.open(theURL,winName,features);
}
function JanelaScroll(theURL,winName,w,h)
{
	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;
	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=1,resizable=0,location=0";
	features += ",menubar=0,toolbar=0,status=0";
	window.open(theURL,winName,features);
}
function maiusculas(objeto)
{
	campo = eval (objeto);
	campo.value = campo.value.toUpperCase();
}
function minusculas(objeto)
{
	campo = eval (objeto);
	campo.value = campo.value.toLowerCase();
}
function checkUncheckAll(theElement)
{
	var theForm = theElement.form, z = 0;
	while (theForm[z].type == 'checkbox' && theForm[z].name != 'todos')
	{
		theForm[z].checked = theElement.checked;
		z++;
	}
}
function confirmSubmit(theTextConfirm,theTextError,theElement)
{
	var theForm = theElement.form, z = 0;
	var encontrou = false;
	while (theForm[z].type == 'checkbox')
	{
		if (theForm[z].checked)
			encontrou = true;
		z++;
	}
	if (encontrou)
		return confirm(theTextConfirm);
	else
		alert(theTextError);
	return false;
}
function verificadata(theElement)
{
	var dia = parseInt(theElement.value.substring(0,2),10);
	var mes = parseInt(theElement.value.substring(3,5),10);
	var ano = parseInt(theElement.value.substring(6,10),10);
	data = new Date();
	if (dia <= 31 && mes <= 12 && ano >= 1900)
	{
		if (theElement.value.substring(0,1) == '0' && theElement.value.substring(1,2) != '0' || theElement.value.substring(0,1) != '0')
		{
			if (theElement.value.substring(2,3) == '/')
			{
				if (theElement.value.substring(3,4) == '0' && theElement.value.substring(4,5) != '0' || theElement.value.substring(3,4) != '0')
				{
					if (theElement.value.substring(5,6) == '/')
					{
						if (theElement.value.substring(6,7) == '0' || theElement.value.substring(6,7) == '' && theElement.value.substring(7,8) != '0')
						{
							alert('Verifique a data!');
							theElement.focus();
							return false;
						}
						if (mes == 2)
						{
							if ((dia > 0) && (dia <= 29))
							{
								if (dia == 29)
								{
									if ((ano % 4) != 0)
									{
										alert('Verifique a data!');
										theElement.focus();
										return false;
									}
								}
							}
							else
							{
								alert('Verifique a data!');
								theElement.focus();
								return false; 
							}
						}
						if ((mes == 4) || (mes == 6) || (mes == 9) || (mes == 11))
						{
							if (!((dia > 0 ) && (dia <= 30)))
							{
								alert('Verifique a data!');
								theElement.focus();
								return false;
							}
						}
						if ((mes == 1) || (mes == 3) || (mes == 5) || (mes ==7) || (mes == 8) || (mes == 10) || (mes == 12))
						{
							if (!((dia > 0) && (dia <= 31)))
							{
								alert('Verifique a data!');
								theElement.focus();
								return false;
							}
						}
					}
					else
					{
						alert('Verifique a data!');
						theElement.focus();
						return false;
					}
				}
				else
				{
					alert('Verifique a data!');
					theElement.focus();
					return false;
				}
			}
			else
			{
				alert('Verifique a data!');
				theElement.focus();
				return false;
			}
		}
		else
		{
			alert('Verifique a data!');
			theElement.focus();
			return false;
		}
	}
	else
	{
		alert('Verifique a data!');
		theElement.focus();
		return false;
	}
	return true;
}
function mascaraNumero(keypress)
{
	if (keypress > 47 && keypress < 58)
		return true;
	return false;
}
function mascaraValor(fld, milSep, decSep, e)
{
	var sep = 0;
	var key = '';
	var i = j = 0;
	var len = len2 = 0;
	var strCheck = '0123456789';
	var aux = aux2 = '';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 13) return true;  // Enter
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
	len = fld.value.length;
	if (len < 10)
	{
		for(i = 0; i < len; i++)
		if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
		aux = '';
		for(; i < len; i++)
		if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
		aux += key;
		len = aux.length;
		if (len == 0) fld.value = '';
		if (len == 1) fld.value = '0'+ decSep + '0' + aux;
		if (len == 2) fld.value = '0'+ decSep + aux;
		if (len > 2)
		{
			aux2 = '';
			for (j = 0, i = len - 3; i >= 0; i--)
			{
				if (j == 3)
				{
					aux2 += milSep;
					j = 0;
				}
				aux2 += aux.charAt(i);
				j++;
			}
			fld.value = '';
			len2 = aux2.length;
			for (i = len2 - 1; i >= 0; i--)
				fld.value += aux2.charAt(i);
			fld.value += decSep + aux.substr(len - 2, len);
		}
		return false;
	}
	return false;
}
function mascaraPlaca(objeto,keypress)
{
	campo = eval (objeto);
	separador = '-'; 
	conjunto = 3;
	if ((keypress > 47 && keypress < 58) || (keypress > 64 && keypress < 91) || (keypress > 96 && keypress < 123))
	{
		if (campo.value.length == conjunto)
		{
			campo.value = campo.value + separador;
		}
		return true;
	}
	return false;
}
function mascaraAnoModelo(keypress,objeto)
{
	campo = eval (objeto);
	separador = '/'; 
	conjunto = 4;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.length == conjunto)
		{
			campo.value = campo.value + separador;
		}
		return true;
	}
	return false;
}
function mascaraTelefone(keypress,objeto)
{
	campo = eval (objeto);
	separador1 = '(';
	separador2 = ')';
	conjunto1 = 0;
	conjunto2 = 3;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.charAt(0) != '(')
			campo.value = '(' + campo.value
		if (campo.value.length == conjunto1)
			campo.value = campo.value + separador1;
		if (campo.value.length == conjunto2)
			campo.value = campo.value + separador2;
		return true;
	}
	else
		return false;
}
function mascaraCEP(keypress,objeto)
{
	campo = eval (objeto);
	separador = '-'; 
	conjunto = 5;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.length == conjunto)
		{
			campo.value = campo.value + separador;
		}
		return true;
	}
	return false;
}
function mascaraCPF(keypress,objeto)
{
	campo = eval (objeto);
	separador1 = '.';
	separador2 = '.';
	separador3 = '-';
	conjunto1 = 3;
	conjunto2 = 7;
	conjunto3 = 11;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.length == conjunto1)
			campo.value = campo.value + separador1;
		if (campo.value.length == conjunto2)
			campo.value = campo.value + separador2;
		if (campo.value.length == conjunto3)
			campo.value = campo.value + separador3;
		return true;
	}
	else
		return false;
}
function mascaradata(keypress,theElement)
{
	campo = eval(theElement);
	separador = '/';
	conjunto1 = 2;
	conjunto2 = 5;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.length == conjunto1)
			campo.value = campo.value + separador;
		if (campo.value.length == conjunto2)
			campo.value = campo.value + separador;
		return true;
	}
	else
		return false;
}
function verificaEnquete(theForm)
{
	z = 0;
	while (theForm[z].type == 'radio')
	{
		if (theForm[z].checked)
			return true;
		z++;
	}
	alert('Selecione uma das opções.');
	return false;
}
function verificaCidade(theForm,cidade_id)
{
	if (theForm.cidade.value == cidade_id)
		return false;
	return true;
}
function verificaCidadeSegmento(theForm,cidade_id,segmento_id)
{
	if (theForm.cidade.value == cidade_id && theForm.segmento.value == segmento_id)
		return false;
	return true;
}
function verificaCategoria(theForm,categoria_id)
{
	if (theForm.categoria.value == categoria_id)
		return false;
	return true;
}
function verificaBuscaVei(theForm)
{
	if (theForm.tipo.selectedIndex == 0 && theForm.marca.selectedIndex == 0 && (theForm.modelo.value == ' digite o modelo' || theForm.modelo.value == ''))
	{
		alert('Selecione ou digite um critério de pesquisa!');
		theForm.tipo.focus();
		return false;
	}
	return true;
}
function verificaBuscaVen(theForm)
{
	if (theForm.vendedor.selectedIndex == 0)
	{
		alert('Selecione a revenda desejada, ou clique em \'particulares\'!');
		theForm.vendedor.focus();
		return false;
	}
	return true;
}
function verificaBuscaRap(theForm)
{
	if (theForm.modelo.value == ' digite o modelo' || theForm.modelo.value == '')
	{
		alert('Selecione ou digite um critério de pesquisa!');
		theForm.modelo.focus();
		return false;
	}
	return true;
}
function verificaBuscaAva(theForm,theForm1)
{
	var z = 0;
	var encontrou = false;
	var acessor = '';
	while (theForm1[z].type == 'checkbox')
	{
		if (theForm1[z].checked)
		{
			encontrou = true;
			acessor += theForm1[z].value;
		}
		z++;
	}
	theForm.lista_acessorios.value = acessor;
	if (theForm.cidade.selectedIndex == 0 && theForm.tipo.selectedIndex == 0 && theForm.estado.selectedIndex == 0 && theForm.combustivel.selectedIndex == 0 && theForm.cor.selectedIndex == 0 && theForm.ano_de.value == '' && theForm.ano_ate.value == '' && theForm.valor_de.value == '' && theForm.valor_ate.value == '' && theForm.marca.selectedIndex == 0 && (theForm.modelo.value == ' digite o modelo' || theForm.modelo.value == ''))
	{
		if (!encontrou)
		{
			alert('Selecione ou digite um critério de pesquisa!');
			theForm.cidade.focus();
			return false;
		}
	}
	if (theForm.ano_de.value != '' && theForm.ano_de.value.length < 4)
	{
		alert('Digite o ano com 4 dígitos!');
		theForm.ano_de.focus();
		return false;
	}
	if (theForm.ano_ate.value != '' && theForm.ano_ate.value.length < 4)
	{
		alert('Digite o ano com 4 dígitos!');
		theForm.ano_ate.focus();
		return false;
	}
	return true;
}
function verificaCPF(theElement)
{
	if (theElement.value.length != 14 || theElement.value == "000.000.000-00" || theElement.value == "111.111.111-11" ||
	theElement.value == "222.222.222-22" || theElement.value == "333.333.333-33" || theElement.value == "444.444.444-44" ||
	theElement.value == "555.555.555-55" || theElement.value == "666.666.666-66" || theElement.value == "777.777.777-77" ||
	theElement.value == "888.888.888-88" || theElement.value == "999.999.999-99")
		return false;
	soma = 0;
	multiplicador = 10;
	for (i = 0; i < 11; i++)
		if (theElement.value.charAt(i) != '.' && theElement.value.charAt(i) != '-')
		{
			soma += parseInt(theElement.value.charAt(i)) * multiplicador;
			multiplicador--;
		}
	resto = 11 - (soma % 11);
	if (resto == 10 || resto == 11)
		resto = 0;
	if (resto != parseInt(theElement.value.charAt(12)))
		return false;
	soma = 0;
	multiplicador = 11;
	for (i = 0; i < 13; i ++)
		if (theElement.value.charAt(i) != '.' && theElement.value.charAt(i) != '-')
		{
			soma += parseInt(theElement.value.charAt(i)) * multiplicador;
			multiplicador--;
		}
	resto = 11 - (soma % 11);
	if (resto == 10 || resto == 11)
		resto = 0;
	if (resto != parseInt(theElement.value.charAt(13)))
		return false;
	return true;
}
function verificaEmail(theForm)
{
	if (theForm.email.value == '')
	{
		alert('Digite seu e-mail!');
		theForm.email.focus();
		return false;
	}
	prim = theForm.email.value.indexOf("@");
	if (prim < 2)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("@",prim + 1) != -1)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf(".") < 1)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf(" ") != -1)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf(";") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf(".@") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("@.") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf(".com.br.") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("/") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("[") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("]") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("(") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf(")") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("'") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("\"") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	if(theForm.email.value.indexOf("..") > 0)
	{
		alert("O e-mail informado não parece estar correto.");
		theForm.email.focus();
		return false;
	}
	return true;
}
function verificaBanco(theForm)
{
	if (theForm.nome.value == '')
	{
		alert('Digite seu nome!');
		theForm.nome.focus();
		return false;
	}
	if (!verificaEmail(theForm))
		return false;
	if (theForm.cidade.value == '')
	{
		alert('Digite sua cidade!');
		theForm.cidade.focus();
		return false;
	}
	if (theForm.telefone.value == '')
	{
		alert('Digite seu telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length < 11)
	{
		alert('Verifique o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.celular.value != '')
	{
		if (theForm.celular.value.length < 11)
		{
			alert('Verifique o celular!');
			theForm.celular.focus();
			return false;
		}
	}
	if (theForm.marca.selectedIndex == 0)
	{
		alert('Selecione a marca do veículo!');
		theForm.marca.focus();
		return false;
	}
	if (theForm.modelo.value == '')
	{
		alert('Digite o modelo do veículo!');
		theForm.modelo.focus();
		return false;
	}
	if (theForm.combustivel.selectedIndex == 0)
	{
		alert('Selecione o combustível do veículo!');
		theForm.combustivel.focus();
		return false;
	}
	return true;
}
function verificaContato(theForm)
{
	if (theForm.nome.value == '')
	{
		alert('Digite seu nome!');
		theForm.nome.focus();
		return false;
	}
	if (!verificaEmail(theForm))
		return false;
	if (theForm.telefone.value == '')
	{
		alert('Digite seu telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length < 11)
	{
		alert('Verifique o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.celular.value != '')
	{
		if (theForm.celular.value.length < 11)
		{
			alert('Verifique o celular!');
			theForm.celular.focus();
			return false;
		}
	}
	return true;
}
function verificaAnuncio1(theForm)
{	
	if (theForm.nome.value == '')
	{
		alert('Digite seu nome!');
		theForm.nome.focus();
		return false;
	}
	if (!verificaCPF(theForm.cpf))
	{
		alert('Verifique o CPF!');
		theForm.cpf.focus();
		return false;
	}
	if (theForm.telefone.value == '')
	{
		alert('Digite o telefone 1!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length < 11)
	{
		alert('Verifique o telefone 1!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone1.value != '')
	{
		if (theForm.telefone1.value.length < 11)
		{
			alert('Verifique o telefone 2!');
			theForm.telefone1.focus();
			return false;
		}
	}
	if (!verificaEmail(theForm))
		return false;
	if (theForm.endereco.value == '')
	{
		alert('Digite seu endereço!');
		theForm.endereco.focus();
		return false;
	}
	if (theForm.bairro.value == '')
	{
		alert('Digite seu bairro!');
		theForm.bairro.focus();
		return false;
	}
	if (theForm.cep.value == '')
	{
		alert('Digite seu CEP!');
		theForm.cep.focus();
		return false;
	}
	if (theForm.cep.value.length < 9)
	{
		alert('Verifique o CEP!');
		theForm.cep.focus();
		return false;
	}
	if (theForm.cidade.value == '')
	{
		alert('Digite sua cidade!');
		theForm.cidade.focus();
		return false;
	}
	if (theForm.estado.value == '')
	{
		alert('Digite seu estado!');
		theForm.estado.focus();
		return false;
	}
	if (theForm.estado.value.length < 2)
	{
		alert('Verifique o estado!');
		theForm.estado.focus();
		return false;
	}
	return true;
}
function verificaAnuncio2FF(theForm,theForm1)
{
	FormFim = theForm1.contentDocument.forms[0];
	
	var encontrou = false;
	var acessor = '';
	
	for (var z = 0; z < FormFim.length; z++)
	{
		
		if(FormFim[z].type == 'checkbox')
		{
		if (FormFim[z].checked)
		{
			encontrou = true;
			acessor += FormFim[z].value;
		}
		}
	}
	theForm.lista_acessorios.value = acessor;

	if (theForm.tipo.selectedIndex == -1)
	{
		alert('Selecione o tipo do veículo!');
		theForm.tipo.focus();
		return false;
	}
	
	if (theForm.marca.selectedIndex == -1)
	{
		alert('Selecione a marca do veículo!');
		theForm.marca.focus();
		return false;
	}
	if (theForm.modelo.value == '')
	{
		alert('Digite o modelo do veículo!');
		theForm.modelo.focus();
		return false;
	}
	if (theForm.estado_veiculo.selectedIndex == -1)
	{
		alert('Selecione o estado do veículo!');
		theForm.estado_veiculo.focus();
		return false;
	}
	if (theForm.ano.value == '')
	{
		alert('Digite o ano/modelo! Formato: AAAA/AAAA');
		theForm.ano.focus();
		return false;
	}
	if (theForm.ano.value.length < 9)
	{
		alert('Verifique o ano/modelo! Formato: AAAA/AAAA');
		theForm.ano.focus();
		return false;
	}
	if (theForm.cor.selectedIndex == -1)
	{
		alert('Selecione a cor!');
		theForm.cor.focus();
		return false;
	}
	if (theForm.combustivel.selectedIndex == -1)
	{
		alert('Selecione o combustível!');
		theForm.combustivel.focus();
		return false;
	}
	if (theForm.placa.value == '')
	{	
		alert('Digite a placa!');
		theForm.placa.focus();
		return false;
	}
	if (theForm.placa.value.length < 8)
	{
		alert('Verifique a placa!');
		theForm.placa.focus();
		return false;
	}
	return true;
}
function verificaAnuncio2(theForm,theForm1)
{
	var encontrou = false;
	var acessor = '';
	
	for (var z = 0; z < theForm1.length; z++)
	{
		
		if(theForm1[z].type == 'checkbox')
		{
		if (theForm1[z].checked)
		{
			encontrou = true;
			acessor += theForm1[z].value;
		}
		}
	}
	theForm.lista_acessorios.value = acessor;

	if (theForm.tipo.selectedIndex == -1)
	{
		alert('Selecione o tipo do veículo!');
		theForm.tipo.focus();
		return false;
	}
	
	if (theForm.marca.selectedIndex == -1)
	{
		alert('Selecione a marca do veículo!');
		theForm.marca.focus();
		return false;
	}
	if (theForm.modelo.value == '')
	{
		alert('Digite o modelo do veículo!');
		theForm.modelo.focus();
		return false;
	}
	if (theForm.estado_veiculo.selectedIndex == -1)
	{
		alert('Selecione o estado do veículo!');
		theForm.estado_veiculo.focus();
		return false;
	}
	if (theForm.ano.value == '')
	{
		alert('Digite o ano/modelo! Formato: AAAA/AAAA');
		theForm.ano.focus();
		return false;
	}
	if (theForm.ano.value.length < 9)
	{
		alert('Verifique o ano/modelo! Formato: AAAA/AAAA');
		theForm.ano.focus();
		return false;
	}
	if (theForm.cor.selectedIndex == -1)
	{
		alert('Selecione a cor!');
		theForm.cor.focus();
		return false;
	}
	if (theForm.combustivel.selectedIndex == -1)
	{
		alert('Selecione o combustível!');
		theForm.combustivel.focus();
		return false;
	}
	if (theForm.placa.value == '')
	{	
		alert('Digite a placa!');
		theForm.placa.focus();
		return false;
	}
	if (theForm.placa.value.length < 8)
	{
		alert('Verifique a placa!');
		theForm.placa.focus();
		return false;
	}
	return true;
}
function verificaAnuncio3(theForm)
{
	if (!theForm.aceito.checked)
	{
		alert('Você não pode continuar se não concordar com todos os termos de adesão!');
		return false;
	}
	return true;
}
function verificaTestemunho(theForm)
{
	if (theForm.nome.value == '')
	{
		alert('Digite seu nome!');
		theForm.nome.focus();
		return false;
	}
	if (!verificaEmail(theForm))
		return false;
	if (theForm.mensagem.value == '')
	{
		alert('Digite seu testemunho!');
		theForm.mensagem.focus();
		return false;
	}
	return true;
}
function verificaFormFinanciamento(theForm,camposVerificar,mensagemVerdadeira)
{
	var ListaDosCamposVerificar = camposVerificar.split("|");
	var ListaDasMensagemVerdadeira = mensagemVerdadeira.split("|");
	
	for (i = 0; i < ListaDosCamposVerificar.length; i++)
	{
		if(ListaDosCamposVerificar[i] != "")
		{
			campo1 = ListaDosCamposVerificar[i];			

			var strName = theForm.name+'.'+campo1+'.value';	
			var str1 = theForm.name+'.'+campo1+'.name';
			var str2 = theForm.name+'.'+campo1;
			
			campoVerificarValorName = eval(strName);
			campoVerificarNome = eval(str1);
			campoFocus = eval(str2);
			
			if(campoFocus.type == "select" || campoFocus.type == "select-one")
			{			
				if(campoFocus.options.selectedIndex == 0 || campoFocus.options.selectedIndex == -1 || campoFocus.options[campoFocus.selectedIndex].value == "" || campoFocus.options[campoFocus.selectedIndex].value == "-")
				{
					//alert('Selecione uma das opções do campo '+campoVerificarNome+'!');
					alert('Selecione uma das opções do campo '+ListaDasMensagemVerdadeira[i]);
					campoFocus.focus();
					return false;
				}
			}
			else if (campoFocus.type == "text" || campoFocus.type == "password" || campoFocus.type == "file" || campoFocus.type == "hidden")
			{
				if(campoVerificarValorName == '')
				{
					//alert('O campo '+campoVerificarNome+' não pode ser vazio!');
					alert('O campo '+ListaDasMensagemVerdadeira[i]+' não pode ser vazio!');
					if(campoFocus.type != "hidden")
						campoFocus.focus();
					return false;
				}
			}
		}
	}
	
	return true;
}
function verificaFormContato(theForm)
{
	if (theForm.nome.value == '')
	{
		alert('Digite seu nome!');
		theForm.nome.focus();
		return false;
	}
	if (!verificaEmail(theForm))
		return false;
	if (theForm.telefone.value == '')
	{
		alert('Digite seu telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length < 12)
	{
		alert('Verifique o telefone!');
		theForm.telefone.focus();
		return false;
	}
	return true;
}
function verificaSubmitTipo(theForm)
{
	if (theForm.tipo.value == '')
	{
		alert('Digite o tipo!');
		theForm.tipo.focus();
		return false;
	}
	return true;
}
function verificaSubmitCategoria(theForm)
{
	if (theForm.categoria.value == '')
	{
		alert('Digite a categoria do link!');
		theForm.categoria.focus();
		return false;
	}
	return true;
}
function verificaSubmitLink(theForm,progressID)
{
	if (theForm.categoria.selectedIndex == -1)
	{
		alert('Selecione a categoria!');
		theForm.categoria.focus();
		return false;
	}
	if (theForm.link.value == '')
	{
		alert('Digite o nome do link!');
		theForm.link.focus();
		return false;
	}
	if (theForm.url.value == '')
	{
		alert('Digite o endereço do link!');
		theForm.url.focus();
		return false;
	}
	ext = theForm.imagem.value;
	if (ext != '')
	{
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();
		if (ext != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.imagem.focus();
			return false;
		}
		startupload(progressID);
	}
	return true;
}
function verificaSubmitAcessorio(theForm)
{
	if (theForm.acessorio.value == '')
	{
		alert('Digite o acessório!');
		theForm.acessorio.focus();
		return false;
	}
	return true;
}
function verificaSubmitTestemunho(theForm)
{
	if (theForm.testemunho.value == '')
	{
		alert('Digite o testemunho!');
		theForm.testemunho.focus();
		return false;
	}
	if (theForm.autor.value == '')
	{
		alert('Digite nome do autor do testemunho!');
		theForm.autor.focus();
		return false;
	}
	return true;
}
function verificaSubmitSegmento(theForm)
{
	if (theForm.segmento.value == '')
	{
		alert('Digite o segmento!');
		theForm.segmento.focus();
		return false;
	}
	return true;
}
function verificaSubmitCusto(theForm)
{
	if (theForm.custo.value == '')
	{
		alert('Digite o custo!');
		theForm.custo.focus();
		return false;
	}
	return true;
}
function verificaSubmitMarca(theForm)
{
	if (theForm.marca.value == '')
	{
		alert('Digite a marca!');
		theForm.marca.focus();
		return false;
	}
	return true;
}
function verificaSubmitCidade(theForm)
{
	if (theForm.cidade.value == '')
	{
		alert('Digite a cidade!');
		theForm.cidade.focus();
		return false;
	}
	return true;
}
function verificaSubmitDestaque(theForm)
{
	if (theForm.titulo1.value == '')
	{
		alert('Digite o título 1!');
		theForm.titulo1.focus();
		return false;
	}
	if (theForm.texto1.value == '')
	{
		alert('Digite o texto 1!');
		theForm.texto1.focus();
		return false;
	}
	if (theForm.titulo2.value == '')
	{
		alert('Digite o título 2!');
		theForm.titulo2.focus();
		return false;
	}
	if (theForm.texto2.value == '')
	{
		alert('Digite o texto 2!');
		theForm.texto2.focus();
		return false;
	}
	return true;
}
function verificaSubmitEnquetes(theForm)
{
	if (theForm.pergunta.value == '')
	{
		alert('Digite a pergunta!');
		theForm.pergunta.focus();
		return false;
	}
	return true;
}
function verificaSubmitOpcoes(theForm)
{
	if (theForm.opcao.value == '')
	{
		alert('Digite a opção!');
		theForm.opcao.focus();
		return false;
	}
	return true;
}
function verificaSubmitAnuncio(theForm,progressID)
{
	if (theForm.empresa.value == '')
	{
		alert('Digite o nome da empresa!');
		theForm.empresa.focus();
		return false;
	}
	if (theForm.segmento.selectedIndex == -1)
	{
		alert('Selecione o segmento!');
		theForm.segmento.focus();
		return false;
	}
	if (theForm.acao.value != 'editar')
	{
		if (access != 'cid')
		{
			if (theForm.cidade.selectedIndex == -1)
			{
				alert('Selecione a cidade do anúncio!');
				theForm.cidade.focus();
				return false;
			}
		}
	}
	if (theForm.endereco.value == '')
	{
		alert('Digite o endereço!');
		theForm.endereco.focus();
		return false;
	}
	if (theForm.telefone.value == '')
	{
		alert('Digite o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length < 12)
	{
		alert('Verifique o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone1.value != '')
	{
		if (theForm.telefone1.value.length < 12)
		{
			alert('Verifique o telefone!');
			theForm.telefone1.focus();
			return false;
		}
	}
	if (theForm.email.value != '')
	{
		prim = theForm.email.value.indexOf("@");
		if (prim < 2)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("@",prim + 1) != -1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".") < 1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(" ") != -1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(";") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".@") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("@.") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".com.br.") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("/") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("[") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("]") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("(") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(")") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("'") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("\"") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("..") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
	}
	ext = theForm.imagem.value;
	if (ext != '')
	{
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();
		if (ext != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.imagem.focus();
			return false;
		}
	}
	ext1 = theForm.foto.value;
	if (ext1 != '')
	{
		ext1 = ext1.substring(ext1.length-3,ext1.length);
		ext1 = ext1.toLowerCase();
		if (ext1 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto.focus();
			return false;
		}
	}
	if (ext != '' || ext1 != '')
		startupload(progressID);
	return true;
}
function verificaSubmitRevenda(access,theForm,progressID)
{
	if (theForm.acao.value != 'editar')
	{
		if (access != 'cid')
		{
			if (theForm.cidade.selectedIndex == -1)
			{
				alert('Selecione a cidade do vendedor!');
				theForm.cidade.focus();
				return false;
			}
		}
		if (theForm.login.value == '')
		{
			alert('Digite o login!');
			theForm.login.focus();
			return false;
		}
		if (theForm.login.value.indexOf(" ") != -1)
		{
			alert("Verifique se há espaços no login!");
			theForm.login.focus();
			return false;
		}
		var nonums = /^[0-9]*$/;
		if (nonums.test(theForm.login.value))
		{
			alert("Digite pelo menos uma letra no login!");
			return false;
		}
	}
	if (theForm.senha.value == '')
	{
		alert('Digite a senha!');
		theForm.senha.focus();
		return false;
	}
	if (theForm.senha.value.indexOf(" ") != -1)
	{
		alert("Verifique se há espaços na senha!");
		theForm.senha.focus();
		return false;
	}
	if (theForm.revenda.value == '')
	{
		alert('Digite o nome da revenda!');
		theForm.revenda.focus();
		return false;
	}
	if (theForm.endereco.value == '')
	{
		alert('Digite o endereço!');
		theForm.endereco.focus();
		return false;
	}
	if (theForm.telefone.value == '')
	{
		alert('Digite o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length < 12)
	{
		alert('Verifique o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone1.value != '')
	{
		if (theForm.telefone1.value.length < 12)
		{
			alert('Verifique o telefone!');
			theForm.telefone1.focus();
			return false;
		}
	}
	if (theForm.contato.value == '')
	{
		alert('Digite o nome do contato!');
		theForm.contato.focus();
		return false;
	}
	if (theForm.email.value != '')
	{
		prim = theForm.email.value.indexOf("@");
		if (prim < 2)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("@",prim + 1) != -1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".") < 1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(" ") != -1)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(";") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".@") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("@.") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(".com.br.") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("/") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("[") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("]") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("(") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf(")") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("'") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("\"") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
		if(theForm.email.value.indexOf("..") > 0)
		{
			alert("O e-mail informado não parece estar correto.");
			theForm.email.focus();
			return false;
		}
	}
	if (access != 'user' && theForm.quantidade.value == '')
	{
		alert('Digite a quantidade de veículos permitida!');
		theForm.quantidade.focus();
		return false;
	}
	ext = theForm.imagem.value;
	if (ext != '')
	{
		if (theForm.acao.value != 'editar')
		{
			if (theForm.particular.checked)
			{
				alert('Cadastros de pessoas físicas não permitem inserção de imagem!');
				theForm.imagem.focus();
				return false;
			}
		}
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();
		if (ext != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.imagem.focus();
			return false;
		}
	}
	ext1 = theForm.foto.value;
	if (ext1 != '')
	{
		if (theForm.acao.value != 'editar')
		{
			if (theForm.particular.checked)
			{
				alert('Cadastros de pessoas físicas não permitem inserção de imagem!');
				theForm.foto.focus();
				return false;
			}
		}
		ext1 = ext1.substring(ext1.length-3,ext1.length);
		ext1 = ext1.toLowerCase();
		if (ext1 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto.focus();
			return false;
		}
	}
	if (theForm.acao.value != 'editar')
	{
		ext2 = theForm.imagem_1.value;
		if (ext2 != '')
		{
			if (theForm.particular.checked)
			{
				alert('Cadastros de pessoas físicas não permitem inserção de imagem!');
				theForm.imagem_1.focus();
				return false;
			}
			ext2 = ext2.substring(ext2.length-3,ext2.length);
			ext2 = ext2.toLowerCase();
			if (ext2 != 'jpg' && ext2 != 'swf')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formatos permitidos: JPG ou SWF!');
				theForm.imagem_1.focus();
				return false;
			}
		}
		ext3 = theForm.imagem_2.value;
		if (ext3 != '')
		{
			ext3 = ext3.substring(ext3.length-3,ext3.length);
			ext3 = ext3.toLowerCase();
			if (ext2 == 'swf' || ext3 != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.imagem_2.focus();
				return false;
			}
		}
		ext4 = theForm.imagem_3.value;
		if (ext4 != '')
		{
			if ((theForm.tem.value == '' && ext2 == '') || (theForm.tem_2.value == '' && ext3 == ''))
			{
				alert('Inclua as imagens na ordem correta!');
				theForm.imagem_2.focus();
				return false;
			}
			ext4 = ext4.substring(ext4.length-3,ext4.length);
			ext4 = ext4.toLowerCase();
			if (ext2 == 'swf' || ext4 != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.imagem_3.focus();
				return false;
			}
		}
	}
	else
	{
		ext2 = theForm.imagem_1.value;
		if (ext2 != '')
		{
			ext2 = ext2.substring(ext2.length-3,ext2.length);
			ext2 = ext2.toLowerCase();
			if (ext2 != 'jpg' && ext2 != 'swf')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formatos permitidos: JPG ou SWF!');
				theForm.imagem_1.focus();
				return false;
			}
		}
		ext3 = theForm.imagem_2.value;
		if (ext3 != '')
		{
			if (theForm.tem.value == '' && ext2 == '')
			{
				alert('Inclua as imagens na ordem correta!');
				theForm.imagem_2.focus();
				return false;
			}
			ext3 = ext3.substring(ext3.length-3,ext3.length);
			ext3 = ext3.toLowerCase();
			if (ext2 == 'swf' || ext3 != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.imagem_2.focus();
				return false;
			}
		}
		ext4 = theForm.imagem_3.value;
		if (ext4 != '')
		{
			if ((theForm.tem.value == '' && ext2 == '') || (theForm.tem_2.value == '' && ext3 == ''))
			{
				alert('Inclua as imagens na ordem correta!');
				theForm.imagem_2.focus();
				return false;
			}
			ext4 = ext4.substring(ext4.length-3,ext4.length);
			ext4 = ext4.toLowerCase();
			if (ext == 'swf' || ext4 != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.imagem_3.focus();
				return false;
			}
		}
	}
	ext5 = theForm.barra.value;
	if (ext5 != '')
	{
		if (theForm.acao.value != 'editar')
		{
			if (theForm.particular.checked)
			{
				alert('Cadastros de pessoas físicas não permitem inserção de imagem!');
				theForm.barra.focus();
				return false;
			}
		}
		ext5 = ext5.substring(ext5.length-3,ext5.length);
		ext5 = ext5.toLowerCase();
		if (ext5 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.barra.focus();
			return false;
		}
	}
	if (ext != '' || ext1 != '' || ext2 != '' || ext3 != '' || ext4 != '' || ext5 != '')
		startupload(progressID);
	return true;
}
function verificaSubmitPedidos(theForm)
{
	if (theForm.nome.value == '')
	{
		alert('Digite o nome!');
		theForm.nome.focus();
		return false;
	}
	if (!verificaEmail(theForm))
		return false;
	if (theForm.cidade.value == '')
	{
		alert('Digite a cidade!');
		theForm.cidade.focus();
		return false;
	}
	if (theForm.telefone.value == '')
	{
		alert('Digite seu telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length < 12)
	{
		alert('Verifique o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.celular.value != '')
	{
		if (theForm.telefone.value.length < 12)
		{
			alert('Verifique o celular!');
			theForm.celular.focus();
			return false;
		}
	}
	if (theForm.marca.selectedIndex == 0)
	{
		alert('Selecione a marca do veículo!');
		theForm.marca.focus();
		return false;
	}
	if (theForm.modelo.value == '')
	{
		alert('Digite o modelo do veículo!');
		theForm.modelo.focus();
		return false;
	}
	if (theForm.combustivel.selectedIndex == -1)
	{
		alert('Selecione o combustível do veículo!');
		theForm.combustivel.focus();
		return false;
	}
	return true;
}
function verificaSubmitBanner(theForm,progressID)
{
	if (theForm.banner.value == '')
	{
		alert('Digite o nome do banner!');
		theForm.banner.focus();
		return false;
	}
	if (theForm.acao.value != 'editar')
	{
		if (theForm.tipo.selectedIndex == -1)
		{
			alert('Selecione o tipo do banner!');
			theForm.tipo.focus();
			return false;
		}
		ext = theForm.imagem.value;
		if (ext != '')
		{
			ext = ext.substring(ext.length-3,ext.length);
			ext = ext.toLowerCase();
			if (ext != 'jpg' && ext != 'swf')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formatos permitidos: JPG ou SWF!');
				theForm.imagem.focus();
				return false;
			}
		}
		else
		{
			alert('Selecione a imagem do banner!');
			theForm.imagem.focus();
			return false;
		}
		ext_2 = theForm.imagem_2.value;
		if (ext_2 != '')
		{
			ext_2 = ext_2.substring(ext_2.length-3,ext_2.length);
			ext_2 = ext_2.toLowerCase();
			if (ext_2 != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.imagem_2.focus();
				return false;
			}
		}
		ext_3 = theForm.imagem_3.value;
		if (ext_3 != '')
		{
			if ((theForm.tem.value == '' && ext == '') || (theForm.tem_2.value == '' && ext_2 == ''))
			{
				alert('Inclua as imagens na ordem correta!');
				theForm.imagem_2.focus();
				return false;
			}
			ext_3 = ext_3.substring(ext_3.length-3,ext_3.length);
			ext_3 = ext_3.toLowerCase();
			if (ext != 'jpg' || ext_2 != 'jpg' || ext_3 != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.imagem_3.focus();
				return false;
			}
		}
		if (ext != '' || ext_2 != '' || ext_3 != '')
			startupload(progressID);
	}
	else
	{
		ext = theForm.imagem.value;
		if (ext != '')
		{
			ext = ext.substring(ext.length-3,ext.length);
			ext = ext.toLowerCase();
			if (ext != 'jpg' && ext != 'swf')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formatos permitidos: JPG ou SWF!');
				theForm.imagem.focus();
				return false;
			}
		}
		ext_2 = theForm.imagem_2.value;
		if (ext_2 != '')
		{
			if (theForm.tem.value == '' && ext == '')
			{
				alert('Inclua as imagens na ordem correta!');
				theForm.imagem.focus();
				return false;
			}
			ext_2 = ext_2.substring(ext_2.length-3,ext_2.length);
			ext_2 = ext_2.toLowerCase();
			if (ext_2 != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.imagem_2.focus();
				return false;
			}
		}
		ext_3 = theForm.imagem_3.value;
		if (ext_3 != '')
		{
			if ((theForm.tem.value == '' && ext == '') || (theForm.tem_2.value == '' && ext_2 == ''))
			{
				alert('Inclua as imagens na ordem correta!');
				theForm.imagem_2.focus();
				return false;
			}
			ext_3 = ext_3.substring(ext_3.length-3,ext_3.length);
			ext_3 = ext_3.toLowerCase();
			if (ext_3 != 'jpg')
			{
				alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
				theForm.imagem_3.focus();
				return false;
			}
		}
		if (ext != '' || ext_2 != '' || ext_3 != '')
			startupload(progressID);
	}
	return true;
}
function verificaSubmitNoticias(theForm,progressID)
{
	if (theForm.data.value == '')
	{
		alert('Digite a data da notícia!');
		theForm.data.focus();
		return false;
	}
	if (theForm.titulo.value == '')
	{
		alert('Digite o título!');
		theForm.titulo.focus();
		return false;
	}
	if (theForm.texto.value == '')
	{
		alert('Digite o texto!');
		theForm.texto.focus();
		return false;
	}
	ext = theForm.foto.value;
	if (theForm.acao.value != 'editar')
	{
		if (ext == '')
		{
			alert('Selecione a imagem!');
			theForm.foto.focus();
			return false;
		}
	}
	if (ext != '')
	{
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();
		if (ext != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto.focus();
			return false;
		}
	}
	ext1 = theForm.foto1.value;
	if (ext1 != '')
	{
		ext1 = ext1.substring(ext1.length-3,ext1.length);
		ext1 = ext1.toLowerCase();
		if (ext1 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto1.focus();
			return false;
		}
	}
	ext2 = theForm.foto2.value;
	if (ext2 != '')
	{
		ext2 = ext2.substring(ext2.length-3,ext2.length);
		ext2 = ext2.toLowerCase();
		if (ext2 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto2.focus();
			return false;
		}
	}
	ext3 = theForm.foto3.value;
	if (ext3 != '')
	{
		ext3 = ext3.substring(ext3.length-3,ext3.length);
		ext3 = ext3.toLowerCase();
		if (ext3 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto3.focus();
			return false;
		}
	}
	ext4 = theForm.foto4.value;
	if (ext4 != '')
	{
		ext4 = ext4.substring(ext4.length-3,ext4.length);
		ext4 = ext4.toLowerCase();
		if (ext4 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto4.focus();
			return false;
		}
	}
	if (ext != '' || ext1 != '' || ext2 != '' || ext3 != '' || ext4 != '')
	    startupload(progressID);
	return true;
}
function verificaSubmitAutoRepasse(access,theForm,theForm1,progressID)
{
	var z = 0;
	var encontrou = false;
	var acessor = '';
	while (theForm1[z].type == 'checkbox')
	{
		if (theForm1[z].checked)
		{
			encontrou = true;
			acessor += theForm1[z].value;
		}
		z++;
	}
	theForm.lista_acessorios.value = acessor;
	if (access != 'user' && theForm.acao.value != 'editar')
	{
		if (theForm.revenda.selectedIndex == -1)
		{
			alert('Selecione a revenda!');
			theForm.revenda.focus();
			return false;
		}
	}
	if (theForm.tipo.selectedIndex == -1)
	{
		alert('Selecione o tipo!');
		theForm.tipo.focus();
		return false;
	}
	if (theForm.marca.selectedIndex == -1)
	{
		alert('Selecione a marca!');
		theForm.marca.focus();
		return false;
	}
	if (theForm.modelo.value == '')
	{
		alert('Digite o modelo!');
		theForm.modelo.focus();
		return false;
	}
	if (theForm.estado.selectedIndex == -1)
	{
		alert('Selecione o estado do veículo!');
		theForm.estado.focus();
		return false;
	}
	if (theForm.ano.value == '')
	{
		alert('Digite o ano/modelo! Formato: AAAA/AAAA');
		theForm.ano.focus();
		return false;
	}
	if (theForm.ano.value.length < 9)
	{
		alert('Verifique o ano/modelo! Formato: AAAA/AAAA');
		theForm.ano.focus();
		return false;
	}
	if (theForm.cor.selectedIndex == -1)
	{
		alert('Selecione a cor!');
		theForm.cor.focus();
		return false;
	}
	if (theForm.combustivel.selectedIndex == -1)
	{
		alert('Selecione o combustível!');
		theForm.combustivel.focus();
		return false;
	}
	if (theForm.placa.value == '')
	{	
		if (!theForm.sem_placa.checked)
		{
			alert('Digite a placa!');
			theForm.placa.focus();
			return false;
		}
	}
	else
	{
		if (theForm.placa.value.length < 8)
		{
			alert('Verifique a placa!');
			theForm.placa.focus();
			return false;
		}
	}
	if (theForm.valor.value == '' || theForm.valor.value == '0,00')
	{	
		alert('Verifique o valor!');
		theForm.valor.focus();
		return false;
	}
	ext_p = theForm.foto_p.value;
	if (ext_p != '')
	{
		ext_p = ext_p.substring(ext_p.length-3,ext_p.length);
		ext_p = ext_p.toLowerCase();
		if (ext_p != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_p.focus();
			return false;
		}
	}
	ext_1 = theForm.foto_1.value;
	if (ext_1 != '')
	{
		if (theForm.tem_p.value == '' && ext_p == '')
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_1 = ext_1.substring(ext_1.length-3,ext_1.length);
		ext_1 = ext_1.toLowerCase();
		if (ext_1 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_1.focus();
			return false;
		}
	}
	ext_2 = theForm.foto_2.value;
	if (ext_2 != '')
	{
		if ((theForm.tem_p.value == '' && ext_p == '') || (theForm.tem_1.value == '' && ext_1 == ''))
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_2 = ext_2.substring(ext_2.length-3,ext_2.length);
		ext_2 = ext_2.toLowerCase();
		if (ext_2 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_2.focus();
			return false;
		}
	}
	ext_3 = theForm.foto_3.value;
	if (ext_3 != '')
	{
		if ((theForm.tem_p.value == '' && ext_p == '') || (theForm.tem_1.value == '' && ext_1 == '') || (theForm.tem_2.value == '' && ext_2 == ''))
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_3 = ext_3.substring(ext_3.length-3,ext_3.length);
		ext_3 = ext_3.toLowerCase();
		if (ext_3 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_3.focus();
			return false;
		}
	}
	ext_4 = theForm.foto_4.value;
	if (ext_4 != '')
	{
		if ((theForm.tem_p.value == '' && ext_p == '') || (theForm.tem_1.value == '' && ext_1 == '') || (theForm.tem_2.value == '' && ext_2 == '') || (theForm.tem_3.value == '' && ext_3 == ''))
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_4 = ext_4.substring(ext_4.length-3,ext_4.length);
		ext_4 = ext_4.toLowerCase();
		if (ext_4 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_4.focus();
			return false;
		}
	}
	ext_5 = theForm.foto_5.value;
	if (ext_5 != '')
	{
		if ((theForm.tem_p.value == '' && ext_p == '') || (theForm.tem_1.value == '' && ext_1 == '') || (theForm.tem_2.value == '' && ext_2 == '') || (theForm.tem_3.value == '' && ext_3 == '') || (theForm.tem_4.value == '' && ext_4 == ''))
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_5 = ext_5.substring(ext_5.length-3,ext_5.length);
		ext_5 = ext_5.toLowerCase();
		if (ext_5 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_5.focus();
			return false;
		}
	}
	if (ext_p != '' || ext_1 != '' || ext_2 != '' || ext_3 != '' || ext_4 != '' || ext_5 != '')
		startupload(progressID);
	return true;
}
function verificaSubmitAuto(access,theForm,theForm1,progressID)
{
	var z = 0;
	var encontrou = false;
	var acessor = '';
	while (theForm1[z].type == 'checkbox')
	{
		if (theForm1[z].checked)
		{
			encontrou = true;
			acessor += theForm1[z].value;
		}
		z++;
	}
	theForm.lista_acessorios.value = acessor;
	if (access != 'user' && theForm.acao.value != 'editar')
	{
		if (theForm.revenda.selectedIndex == -1)
		{
			alert('Selecione a revenda!');
			theForm.revenda.focus();
			return false;
		}
	}
	if (access != 'user')
		if (theForm.expira.value != '')
			if (!verificadata(theForm.expira))
				return false;
	if (theForm.tipo.selectedIndex == -1)
	{
		alert('Selecione o tipo!');
		theForm.tipo.focus();
		return false;
	}
	if (theForm.marca.selectedIndex == -1)
	{
		alert('Selecione a marca!');
		theForm.marca.focus();
		return false;
	}
	if (theForm.modelo.value == '')
	{
		alert('Digite o modelo!');
		theForm.modelo.focus();
		return false;
	}
	if (theForm.estado.selectedIndex == -1)
	{
		alert('Selecione o estado do veículo!');
		theForm.estado.focus();
		return false;
	}
	if (theForm.ano.value == '')
	{
		alert('Digite o ano/modelo! Formato: AAAA/AAAA');
		theForm.ano.focus();
		return false;
	}
	if (theForm.ano.value.length < 9)
	{
		alert('Verifique o ano/modelo! Formato: AAAA/AAAA');
		theForm.ano.focus();
		return false;
	}
	if (theForm.cor.selectedIndex == -1)
	{
		alert('Selecione a cor!');
		theForm.cor.focus();
		return false;
	}
	if (theForm.combustivel.selectedIndex == -1)
	{
		alert('Selecione o combustível!');
		theForm.combustivel.focus();
		return false;
	}
	if (theForm.placa.value == '')
	{	
		if (!theForm.sem_placa.checked)
		{
			alert('Digite a placa!');
			theForm.placa.focus();
			return false;
		}
	}
	else
	{
		if (theForm.placa.value.length < 8)
		{
			alert('Verifique a placa!');
			theForm.placa.focus();
			return false;
		}
	}
	ext_p = theForm.foto_p.value;
	if (ext_p != '')
	{
		ext_p = ext_p.substring(ext_p.length-3,ext_p.length);
		ext_p = ext_p.toLowerCase();
		if (ext_p != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_p.focus();
			return false;
		}
	}
	ext_1 = theForm.foto_1.value;
	if (ext_1 != '')
	{
		if (theForm.tem_p.value == '' && ext_p == '')
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_1 = ext_1.substring(ext_1.length-3,ext_1.length);
		ext_1 = ext_1.toLowerCase();
		if (ext_1 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_1.focus();
			return false;
		}
	}
	ext_2 = theForm.foto_2.value;
	if (ext_2 != '')
	{
		if ((theForm.tem_p.value == '' && ext_p == '') || (theForm.tem_1.value == '' && ext_1 == ''))
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_2 = ext_2.substring(ext_2.length-3,ext_2.length);
		ext_2 = ext_2.toLowerCase();
		if (ext_2 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_2.focus();
			return false;
		}
	}
	ext_3 = theForm.foto_3.value;
	if (ext_3 != '')
	{
		if ((theForm.tem_p.value == '' && ext_p == '') || (theForm.tem_1.value == '' && ext_1 == '') || (theForm.tem_2.value == '' && ext_2 == ''))
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_3 = ext_3.substring(ext_3.length-3,ext_3.length);
		ext_3 = ext_3.toLowerCase();
		if (ext_3 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_3.focus();
			return false;
		}
	}
	ext_4 = theForm.foto_4.value;
	if (ext_4 != '')
	{
		if ((theForm.tem_p.value == '' && ext_p == '') || (theForm.tem_1.value == '' && ext_1 == '') || (theForm.tem_2.value == '' && ext_2 == '') || (theForm.tem_3.value == '' && ext_3 == ''))
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_4 = ext_4.substring(ext_4.length-3,ext_4.length);
		ext_4 = ext_4.toLowerCase();
		if (ext_4 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_4.focus();
			return false;
		}
	}
	ext_5 = theForm.foto_5.value;
	if (ext_5 != '')
	{
		if ((theForm.tem_p.value == '' && ext_p == '') || (theForm.tem_1.value == '' && ext_1 == '') || (theForm.tem_2.value == '' && ext_2 == '') || (theForm.tem_3.value == '' && ext_3 == '') || (theForm.tem_4.value == '' && ext_4 == ''))
		{
			alert('Inclua as imagens na ordem correta!');
			theForm.foto_p.focus();
			return false;
		}
		ext_5 = ext_5.substring(ext_5.length-3,ext_5.length);
		ext_5 = ext_5.toLowerCase();
		if (ext_5 != 'jpg')
		{
			alert('O arquivo selecionado não poderá ser enviado. Formato permitido: JPG!');
			theForm.foto_5.focus();
			return false;
		}
	}
	if (ext_p != '' || ext_1 != '' || ext_2 != '' || ext_3 != '' || ext_4 != '' || ext_5 != '')
		startupload(progressID);
	return true;
}
function verificaSubmitSenha(theForm)
{
	if (theForm.login.value == '')
	{
		alert('Digite o login do usuário!');
		theForm.login.focus();
		return false;
	}
	if (theForm.senha1.value == '')
	{
		alert('Digite a senha!');
		theForm.senha1.focus();
		return false;
	}
	if (theForm.senha2.value == '')
	{
		alert('Confirme a senha!');
		theForm.senha2.focus();
		return false;
	}
	if (theForm.senha1.value != theForm.senha2.value)
	{
		alert('Confirmação de senha não confere!');
		theForm.senha1.focus();
		return false;
	}
	return true;
}