//VERIFICANDO O NAVEGADOR
if (navigator.appName.indexOf('Microsoft') != -1){   
    clientNavigator = "IE";   
}else{   
    clientNavigator = "Other";   
} 
// POP UP
function popup(theURL, width, height, features) { 
	//"location=no,menubar=no,resiable=no,toolbar=no,scroollbars=yes"
	if(window.screen){
		per_ancho=(width/screen.width)*100;
		per_alto=(height/width)*100;
		win_ancho=(screen.width*per_ancho)/100;
		win_alto=(win_ancho*per_alto)/100;
		x=(screen.width-win_ancho)/2;
		y=(screen.height-win_alto)/2;
	}else{
		x=0;
		y=0;
		win_ancho=w;
		win_alto=y;
	}
	winfeatures=("top="+y+",left="+x+",width="+win_ancho+",height="+win_alto+","+features);
	window.open(theURL, 'popup', winfeatures);
}

function nada() {
   return;
}
// NEWSLETTER
function verificaNewsletter() {
	if (!vazio(document.formNewsletter.email, "E-mail")) {
		return false;
	}
	if (!verifica_email(document.formNewsletter.email)) {
		return false;
	}else {
		document.formNewsletter.submit();
	}
}
function verifica_email(textarea) {
	var filter  = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
	var x = textarea.value;
	if (filter.test(x)){
		return true;
	}else{
		alert('E-mail em formato incorreto!');
		textarea.focus();
		textarea.select();
	}
}
function vazio(campo, nome) {
	var valor = campo.value;
	if (valor == 'digite seu e-mail') {
		campo.value = ' ';
		campo.focus();
		alert("Favor preencher o campo "+nome+" !");
		return false;
	} else if (valor.length == 0) {
		campo.focus();
		alert("Favor preencher o campo "+nome+" !");
		return false;
	} else {
		if (valor.substring(0, 1) == " ") {
			campo.focus();
			if (valor.substring(0, 1) == " " && valor.substring(1, 2) != " ") {
				alert("O campo "+nome+" não pode começar com o espaço!");
			} else {
				campo.focus();
				alert("Favor preencher o campo "+nome+" !");
				return false;
			}
		} else {
			return true;
		}
	}
}
//
//FLASH
function flash(versao, largura, altura, nome, modo, cor)
{
	/*
	versao = 8 .................. <- Versão do player
	largura = 200px ............. <- Largura do SWF
	altura = 200px .............. <- Altura do SWF
	id = nome ................... <- ID do arquivo
	nome = arquivo.swf .......... <- Caminho do SWF, essa opção não pode ser vazia
	modo = transparent/opaque ... <- Flash transparente ou opaco / pode ser vazia
	cor = #ffffff ............... <- Cor de fundo
	*/
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="'+versao+',0,0,0" width="'+largura+'" height="'+altura+'">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain">\n');
	document.write('<param name="movie" value="'+nome+'">\n');
	document.write('<param name="wmode" value="'+modo+'">\n');
	document.write('<param name="bgcolor" value="'+cor+'">\n');
	document.write('<embed src="'+nome+'" wmode="'+modo+'" bgcolor="'+cor+'" width="'+largura+'" height="'+altura+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\n');
	document.write('</object>\n');
}
// DATA - ÍNICIO
function data() {
	mdata = new Date();
	mhora = mdata.getHours();
	mminuto = mdata.getMinutes();
	msegundos = mdata.getSeconds();
	mdia = mdata.getDate();
	mdiasemana = mdata.getDay();
	mmes = mdata.getMonth();
	mano = mdata.getFullYear();
	if (mdiasemana == 0) {
		document.write("'Domingo, ");
	} else if (mdiasemana == 1) {
		document.write("Segunda-feira, ");
	} else if (mdiasemana == 2) {
		document.write("Ter&ccedil;a-feira, ");
	} else if (mdiasemana == 3) {
		document.write("Quarta-feira, ");
	} else if (mdiasemana == 4) {
		document.write("Quinta-feira, ");
	} else if (mdiasemana == 5) {
		document.write("Sexta-feira, ");
	} else if (mdiasemana == 6) {
		document.write("S&aacute;bado, ");
	}
	document.write(+mdia+' de ');
	if (mmes == 0) {
		document.write("janeiro de ");
	} else if (mmes == 1) {
		document.write("fevereiro de ");
	} else if (mmes == 2) {
		document.write("mar&ccedil;o de ");
	} else if (mmes == 3) {
		document.write("abril de ");
	} else if (mmes == 4) {
		document.write("maio de ");
	} else if (mmes == 5) {
		document.write("junho de ");
	} else if (mmes == 6) {
		document.write("julho de ");
	} else if (mmes == 7) {
		document.write("agosto de ");
	} else if (mmes == 8) {
		document.write("setembro de ");
	} else if (mmes == 9) {
		document.write("outubro de ");
	} else if (mmes == 10) {
		document.write("novembro de ");
	} else if (mmes == 11) {
		document.write("dezembro de ");
	}
	document.write(mano);
}
// DATA - FIM
// IS NUMERIC
//onKeyPress="return(IsNumeric(this,event))"
function IsNumeric(fld, e) 
{
	var strCheck = '0123456789';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	key = String.fromCharCode(whichCode);
	if (strCheck.indexOf(key) == -1) return false;
}
//LAYER
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;
			}
			if (obj.visibility=='hidden'){
				obj.visibility='visible';
			}
			else{
				obj.visibility='hidden';
			}
			
		}
	}
}

function mask(fld, e) 
{
	if(fld.value.length == 2){
		fld.value = fld.value + "/";
	}
	if(fld.value.length == 5 ){
		fld.value = fld.value + "/";
	}
	var strCheck = '0123456789';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	key = String.fromCharCode(whichCode);
	if (strCheck.indexOf(key) == -1) return false;
}

/*POPUP DO RESULTADO DA PESQUISA NO EXTERIOR*/
function resultadoPopupShow(){
	document.getElementById("resultadoPopup").style.display = "block";
	document.getElementById("resultadoBackground").style.display = "block";
	document.getElementById("pesquisa").style.display = "none";
}
function resultadoPopupHide(){
	document.getElementById("resultadoPopup").style.display = "none";
	document.getElementById("resultadoBackground").style.display = "none";
	document.getElementById("resultadoFrame").src = "_load.php";
	document.getElementById("pesquisa").style.display = "block";
}

//VALIDA CONTATO
function validaContato(){
	frm = document.formContato;
	if (frm.nome.value.length==0){
		alert ("Preencha o campo Nome!");
		frm.nome.focus();
		return false;
	}
	if (frm.email.value.length==0){
		alert ("Preencha o campo E-mail!");
		frm.email.focus();
		return false;
	}
	if (frm.ddd.value.length==0){
		alert ("Preencha o campo DDD!");
		frm.ddd.focus();
		return false;
	}	
	if (frm.telefone.value.length==0){
		alert ("Preencha o campo Telefone!");
		frm.telefone.focus();
		return false;
	}
	if (frm.cidade.value.length==0){
		alert ("Preencha o campo Cidade!");
		frm.cidade.focus();
		return false;
	}
	if (frm.estado.value==0){
		alert ("Selecione um Estado!");
		frm.estado.focus();
		return false;
	}
	if (frm.mensagem.value.length==0){
		alert ("Preencha o campo Mensagem!");
		frm.mensagem.focus();
		return false;
	}
}		


//VALIDA COTAÇÃO
function validaCotacao(){
	frm = document.formCotacao;
	if (frm.nome.value.length==0){
		alert ("Preencha o campo Nome!");
		frm.nome.focus();
		return false;
	}
	if (frm.email.value.length==0){
		alert ("Preencha o campo E-mail!");
		frm.email.focus();
		return false;
	}
	if (frm.cep.value.length==0){
		alert ("Preencha o campo CEP!");
		frm.cep.focus();
		return false;
	}	
	if (frm.veiculo.value.length==0){
		alert ("Preencha o campo Veículo/Moto!");
		frm.veiculo.focus();
		return false;
	}
}		

//MASCARA DATA
function maskData(input, evnt){   
//Ajusta máscara de Data e só permite digitação de números   
    if (input.value.length == 2 || input.value.length == 5){   
        if(clientNavigator == "IE"){   
            input.value += "/";   
        }else{   
            if(evnt.keyCode == 0){   
                input.value += "/";   
            }   
        }   
    } 
}

//VALIDAÇÃO DATA 
function VerificaData(input, digData){
	var bissexto = 0;
	var data = digData; 
	var tam = data.length;
	if (tam == 10) 
	{
		var dia = data.substr(0,2)
		var mes = data.substr(3,2)
		var ano = data.substr(6,4)
		if ((ano > 1900)||(ano < 2100))
		{
			switch (mes) 
			{
				case '01':
				case '03':
				case '05':
				case '07':
				case '08':
				case '10':
				case '12':
					if  (dia <= 31) 
					{
						return true;
					}
					break
				
				case '04':        
				case '06':
				case '09':
				case '11':
					if  (dia <= 30) 
					{
						return true;
					}
					break
				case '02':
					/* Validando ano Bissexto / fevereiro / dia */ 
					if ((ano % 4 == 0) || (ano % 100 == 0) || (ano % 400 == 0)) 
					{ 
						bissexto = 1; 
					} 
					if ((bissexto == 1) && (dia <= 29)) 
					{ 
						return true;                 
					} 
					if ((bissexto != 1) && (dia <= 28)) 
					{ 
						return true; 
					}            
					break                        
			}
		}
	}
	if (input.value){
		alert("A Data "+data+" é inválida!");
		input.focus();
		input.value="";
		return false;
	}
return false;
}


//MASCARA TELEFONE
function maskTEL(input, evnt){   
    if (input.value.length == 1){   
        if(clientNavigator == "IE"){   
            input.value = "("+input.value;   
        }else{   
            if(evnt.keyCode == 0){   
               input.value = "("+input.value;   
            }   
        }   
    }
	
	if (input.value.length == 3){   
        if(clientNavigator == "IE"){   
            input.value = input.value+") ";   
        }else{   
            if(evnt.keyCode == 0){   
               input.value = input.value+") ";   
            }   
        }   
    }
	
	if (input.value.length == 9){   
        if(clientNavigator == "IE"){   
            input.value +="-";   
        }else{   
            if(evnt.keyCode == 0){   
                input.value +="-";  
            }   
        }   
    }
}

//VALIDAR TELEFONE
function validaTEL(input){
	if (input.value.length < 14 && input.value.length != 0){
		alert ('Número de telefone incompleto!');
		input.select();
		return false;
	}
}

//VALIDAR E-MAIL
function emailValidar(textarea) {
	var filter  = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
	var x = textarea.value;
	
	if (x!=""){
		if (filter.test(x)){
			return true;
		}else{
			alert('E-mail em formato incorreto!');
			textarea.focus();
			textarea.select();
		}
	}
}
/*DETECTANDO A VERSÃO DO PLAYER DO FLASH*/
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 0;
// the version of javascript supported
var jsVersion = 1.0;
// -----------------------------------------------------------------------------
// -->
