function fnAdicionaFavoritos(){
	str_titulo = "Applàuso a sua concessionária Fiat definitivamente ";
	str_url = "http://www.fiatapplauso.com.br/";
	if(window.sidebar){ window.sidebar.addPanel(str_titulo,str_url,""); }
	else if(window.external){ window.external.AddFavorite(str_url,str_titulo); }
	else if(window.opera && window.print){ return true; }
}
function MM_openBrWindow(theURL,winName,features){
	var myWin = window.open(theURL,winName,features);
	myWin.focus();
}
function fnTarget(str_target){
	var ch_tag_A, vet_A, int_i;
	var str_titulo;
    ch_tag_A = document.getElementsByTagName('a');
    for(int_i=0; int_i<ch_tag_A.length; int_i++){
		vet_A = ch_tag_A[int_i];
		if(vet_A.getAttribute("href")&& vet_A.getAttribute('rel') != null){
			if(vet_A.getAttribute('rel').substring(0,8) == 'external'){
				vet_A.target = str_target;
				str_titulo = ch_tag_A.title;
				ch_tag_A.title = str_titulo;
			}
		}
	}
}
function fnMostraOculta(pId){
	if(document.getElementById(pId).style.display == 'block'){ document.getElementById(pId).style.display='none'; }
	else{ document.getElementById(pId).style.display='block'; }
}
function fnFlash(str_url,int_largura,int_altura){
	document.writeln('<object type="application/x-shockwave-flash" data="'+str_url+'" width="'+int_largura+'" height="'+int_altura+'">');
	document.writeln('<param name="movie" value="'+str_url+'">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('</object>');
}

function ValidaForm_Agende_Test(form){
	if(form.nome.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	if(form.enderec.value.length<=1){
		alert("O campo Endereço deve estar preenchido corretamente.");
		form.enderec.focus();
		return false;
	}
	var str_email = form.email.value;
    if((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)||(str_email == 'Email:')){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.email.focus();
    	return false;
	}
	if(form.telefone.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}
	if(form.carro.value.length<=1){
		alert("O campo Carro deve estar preenchido corretamente.");
		form.carro.focus();
		return false;
	}
	if(form.data.value.length<=1){
		alert("O campo Data deve estar preenchido corretamente.");
		form.data.focus();
		return false;
	}
	if(form.horario.value.length<=1){
		alert("O campo Horario deve estar preenchido corretamente.");
		form.horario.focus();
		return false;
	}
}
function ValidaForm_Revisao(form){
	if(form.nome.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	if(form.telefone.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}
	if(form.enderec.value.length<=1){
		alert("O campo Endereço deve estar preenchido corretamente.");
		form.enderec.focus();
		return false;
	}
	if(form.bairro.value.length<=1){
		alert("O campo Bairro deve estar preenchido corretamente.");
		form.bairro.focus();
		return false;
	}
	var str_email = form.email.value;
    if((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)||(str_email == 'Email:')){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.email.focus();
    	return false;
	}
	if(form.cidade.value.length<=1){
		alert("O campo Cidade deve estar preenchido corretamente.");
		form.cidade.focus();
		return false;
	}
	if(form.estado.value.length<=1){
		alert("O campo Estado deve estar preenchido corretamente.");
		form.estado.focus();
		return false;
	}
	if(form.marca.value.length<=1){
		alert("O campo Marca deve estar preenchido corretamente.");
		form.marca.focus();
		return false;
	}
	if(form.modelo.value.length<=1){
		alert("O campo Modelo deve estar preenchido corretamente.");
		form.modelo.focus();
		return false;
	}
	if(form.ano.value.length<=1){
		alert("O campo Ano deve estar preenchido corretamente.");
		form.ano.focus();
		return false;
	}
	if(form.placa.value.length<=1){
		alert("O campo Placa deve estar preenchido corretamente.");
		form.placa.focus();
		return false;
	}
	if(form.combustivel.value.length<=1){
		alert("O campo Combustível deve estar preenchido corretamente.");
		form.combustivel.focus();
		return false;
	}
	if(form.kilometragem.value.length<=1){
		alert("O campo Kilometragem deve estar preenchido corretamente.");
		form.kilometragem.focus();
		return false;
	}
	if(form.agendar.value.length<=1){
		alert("O campo Agendar deve estar preenchido corretamente.");
		form.agendar.focus();
		return false;
	}
	if(form.mensagem.value.length<=1){
		alert("O campo Descrição da Revisão deve estar preenchido corretamente.");
		form.mensagem.focus();
		return false;
	}
	
}
function ValidaForm_Contato(form){
	if(form.nome_contato.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome_contato.focus();
		return false;
	}
	var str_email = form.email_contato.value;
    if((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)||(str_email == 'Email:')){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.email_contato.focus();
    	return false;
	}
	if(form.telefone_contato.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone_contato.focus();
		return false;
	}
	if(form.cidade_contato.value.length<=1){
		alert("O campo Cidade deve estar preenchido corretamente.");
		form.cidade_contato.focus();
		return false;
	}
	if(form.estado_contato.value.length<=1){
		alert("O campo Estado deve estar selecionado corretamente.");
		form.estado_contato.focus();
		return false;
	}
	if(form.mensagem_contato.value.length<=1){
		alert("O campo Mensagem deve estar preenchido corretamente.");
		form.mensagem_contato.focus();
		return false;
	}
	if(form.cod.value.length<=1){
		alert("O campo Código de Segurança deve estar preenchido corretamente.");
		form.cod.focus();
		return false;
	}
}
function ValidaForm_Pecas(form){
	if(form.nome.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	if(form.telefone.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}
	var str_email = form.emaill.value;
    if((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)||(str_email == 'Email:')){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.emaill.focus();
    	return false;
	}
	if(form.modelo.value.length<=1){
		alert("O campo Modelo deve estar preenchido corretamente.");
		form.modelo.focus();
		return false;
	}
	if(form.mensagem.value.length<=1){
		alert("O campo Mensagem deve estar preenchido corretamente.");
		form.mensagem.focus();
		return false;
	}
}

function ValidaForm_Agoge(form){
	if(form.nome.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	var str_email = form.emaill.value;
    if((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)||(str_email == 'Email:')){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.emaill.focus();
    	return false;
	}
	if(form.telefone.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}
	if(form.mensagem.value.length<=1){
		alert("O campo Mensagem deve estar preenchido corretamente.");
		form.mensagem.focus();
		return false;
	}
}
function fnMascara(objeto,evt,mask){
	var LetrasU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var LetrasL = 'abcdefghijklmnopqrstuvwxyz';
	var Letras  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
	var Numeros = '0123456789';
	var Fixos  = '().-:/ ';
	var Charset = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_/`abcdefghijklmnopqrstuvwxyz{|}~";
	evt = (evt) ? evt : (window.event) ? window.event : "";
	var value = objeto.value;
	if(evt){
		var ntecla = (evt.which) ? evt.which : evt.keyCode;
		tecla = Charset.substr(ntecla - 32,1);
		if(ntecla < 32) return true;
		var tamanho = value.length;
		if(tamanho >= mask.length) return false;
		var pos = mask.substr(tamanho,1);
		while(Fixos.indexOf(pos) != -1){
 	 		value += pos;
 	 		tamanho = value.length;
 	 		if(tamanho >= mask.length) return false;
 	 		pos = mask.substr(tamanho,1);
		}
		switch(pos){
   			case '#': if(Numeros.indexOf(tecla) == -1) return false; break;
   			case 'A': if(LetrasU.indexOf(tecla) == -1) return false; break;
   			case 'a': if(LetrasL.indexOf(tecla) == -1) return false; break;
   			case 'Z': if(Letras.indexOf(tecla) == -1) return false; break;
   			case '*': objeto.value = value; return true; break;
   			default: return false; break;
 		}
	}
	objeto.value = value;
	return true;
}
function ValidaForm_Busca(form){
	var contador;
	var flag;
	flag = false;
	for(contador=0; contador<form.busca.length; contador++){
		if(form.busca[contador].checked){ flag = true; }
	}
	if(!flag){
		alert("O campo Novos ou Seminovos deve estar preenchido corretamente.");
		return false;
	}   
}
function ValidaForm_Orcamento(form){
	if(form.nome.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	if(form.nascimento.value.length<=1){
		alert("O campo Data Nascimento deve estar preenchido corretamente.");
		form.nascimento.focus();
		return false;
	}
	if(form.sexo.value.length<=1){
		alert("O campo Sexo deve estar preenchido corretamente.");
		form.sexo.focus();
		return false;
	}
	/*var contador;
	var flag;
	flag = false;
	for(contador=0; contador<form.sexo.length; contador++){
		if(form.sexo[contador].checked){ flag = true; }
	}
	if(!flag){
		alert("O campo Sexo deve estar preenchido corretamente.");
		return false;
	}   */
	if(form.endereco.value.length<=1){
		alert("O campo Endereço deve estar preenchido corretamente.");
		form.endereco.focus();
		return false;
	}
	if(form.bairro.value.length<=1){
		alert("O campo Bairro deve estar preenchido corretamente.");
		form.bairro.focus();
		return false;
	}
	if(form.cep.value.length<=1){
		alert("O campo CEP deve estar preenchido corretamente.");
		form.cep.focus();
		return false;
	}
	if(form.cidade.value.length<=1){
		alert("O campo Cidade deve estar preenchido corretamente.");
		form.cidade.focus();
		return false;
	}
	if(form.estado.value.length<=1){
		alert("O campo Estado deve estar selecionado corretamente.");
		form.estado.focus();
		return false;
	}
	if(form.telefone.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}
	var str_email = form.email.value;
    if((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)||(str_email == 'Email:')){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.email.focus();
    	return false;
	}
}
function ValidaNews(form){	
	var str_email = form.email.value;
    if(str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
    	alert("O campo EMAIL deve ser preenchido corretamente.");
    	form.email.focus();
    	return false;
	}	
}
function verificaEmail(newsletter,tipo){
	document.getElementById('acao').value = tipo;
	if(newsletter.email.value == ""){
		alert("Atenção!\nO campo EMAIL deve ser preenchido!");
		newsletter.email.focus();
		return false;
	}
	if(newsletter.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("Atenção!\nVocê não preencheu o campo EMAIL corretamente!");
		newsletter.email.focus();
		return false;
	}
	return true;
}
function ValidaForm_Juntese(form){
	if(form.nome.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	if(form.nascimento.value.length<=1){
		alert("O campo Data de Nascimento deve estar preenchido corretamente.");
		form.nascimento.focus();
		return false;
	}
	if(form.sexo.value.length<=1){
		alert("O campo Sexo deve estar preenchido corretamente.");
		form.sexo.focus();
		return false;
	}
	/*var contador;
	var flag;
	flag = false;
	for(contador=0; contador<form.sexo.length; contador++){
		if(form.sexo[contador].checked){ flag = true; }
	}
	if(!flag){
		alert("O campo Sexo deve estar preenchido corretamente.");
		return false;
	}   */
	if(form.estadocivil.value.length<=1){
		alert("O campo Estado Civil deve estar preenchido corretamente.");
		form.estadocivil.focus();
		return false;
	}
	if(form.endereco_junt.value.length<=1){
		alert("O campo Endereço deve estar preenchido corretamente.");
		form.endereco_junt.focus();
		return false;
	}
	if(form.bairro.value.length<=1){
		alert("O campo Bairro deve estar preenchido corretamente.");
		form.bairro.focus();
		return false;
	}
	if(form.cidade.value.length<=1){
		alert("O campo Cidade deve estar preenchido corretamente.");
		form.cidade.focus();
		return false;
	}
	if(form.estado_junt.value.length<=1){
		alert("O campo Estado deve estar preenchido corretamente.");
		form.estado_junt.focus();
		return false;
	}
	if(form.cep.value.length<=1){
		alert("O campo CEP deve estar preenchido corretamente.");
		form.cep.focus();
		return false;
	}
	if(form.telefone.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}	
}
function fnAbreVideo(){	abreAjax('video.php','video','GET'); }
