// REDIMENSIONA AS IMAGENS CASO SEJAM MAIORES QUE A LARGURA PERMITIDA DO SITE
// ----------------------------------------------------------------------------
window.onload = function() {
	RedimensionaImagens(350);
}

function RedimensionaImagens(tamanhoimg) {
  var obj = document.getElementsByTagName("div");
  for(var i = 0;i<obj.length;i++) {
    if (obj[i].className == "imgstyle") {
      var img = obj[i].getElementsByTagName("img");
      if (img[0].width > tamanhoimg) { obj[i].innerHTML = '<img src="' + img[0].src + '" width="'+ tamanhoimg +'">' + '<br><a href="' + img[0].src + '" target="_blank">Veja a imagem no tamanho original</a>'; }
    }
  }
}


//===============================================================================
//= VERIFICA NAVEGADORES ========================================================
//===============================================================================
var ua = navigator.userAgent;
var ver = parseInt( navigator.appVersion );
var opera = /opera [56789]|opera\/[56789]/i.test(ua);
var ie = !opera && /MSIE/.test(ua);
var ie6 = ie && /MSIE [0123456]/.test(ua);
var ie7 = ie && /MSIE [789]/.test(ua);
var ieBox = ie && (document.compatMode == null || document.compatMode != "CSS1Compat");
var moz = !opera && /gecko/i.test(ua);
var nn6 = !opera && /netscape.*6\./i.test(ua);


// FUNÇÃO PARA EXIBIÇÃO DE FLASHS
// ----------------------------------------------------------------------------
function ExibeFlash(movie,w,h,wmode,bg) {
		if(wmode == "transparent") { ftransp = true; wmode = "wmode='transparent'"; } else { ftransp = false; wmode = ""; };
	
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'">');
		if(ftransp) { document.write('<param name="wmode" value="transparent"/>'); };
		document.write('<param name="quality" value="high"/>');
		document.write('<param name="movie" value="'+movie+'"/>');
		document.write('<embed src="'+movie+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" '+wmode+' width="'+w+'" height="'+h+'"></embed>');
		document.write('</object>');
}


//===============================================================================
//= ABRE POP-UP CENTRALIZADO ====================================================
//===============================================================================
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = parseInt((screen.width) ? (screen.width-w)/2 : 0);
	TopPosition = parseInt((screen.height) ? (screen.height-h)/2 : 0);
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',noresizable,status=yes'
	win = window.open(mypage,myname,settings)
}


//===============================================================================
//= REDIMENSIONA POP-UP =========================================================
//===============================================================================
function Redimensiona(w, h) {
	//Corrige o tamanho da janela
	if (navigator.appName == "Microsoft Internet Explorer") {
		w = parseInt(w) + 10;
		h = parseInt(h) + 48;
	} else {
		w = parseInt(w) + 6;
		h = parseInt(h) + 49;
	};
	// IE 7
	var nversao = navigator.userAgent;
	var nresult = nversao.search(/\bMSIE 7.0\b/g);
	if (nresult > 0) {
		h = parseInt(h) + 30;
	};
	//
	// FIREFOX 3
	var nversao = navigator.userAgent;
	var nresult = nversao.search(/\bFirefox\/3.0\b/g);
	if (nresult > 0) {
		h = parseInt(h) + 30;
	};
	//
	// SAFARI / CHROME
	var nversao = navigator.userAgent;
	var nresult = nversao.search(/\bSafari\b/g);
	if (nresult > 0) {
		h = parseInt(h) + 10;
	};
	//
	LeftPosition =  parseInt((screen.width) ? (screen.width-w)/2 : 0);
	TopPosition =  parseInt((screen.height) ? (screen.height-h)/2 : 0);
	window.moveTo(LeftPosition,TopPosition);
	window.resizeTo(w, h);
	window.focus();
}


// TRABALHA COM COOKIES
// ----------------------------------------------------------------------------
function getCookieVal(inicio) {
	var fim = document.cookie.indexOf(";", inicio);
	if (fim == -1) fim = document.cookie.length;
	return unescape(document.cookie.substring(inicio, fim));
}

function getCookie(label) {
	var arg = label + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i,j) == arg) return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

function setCookie(label, valor, expires) {
	document.cookie = label + "=" + escape(valor) + 
		((expires) ? "; expires=" + expires.toGMTString() : "");
}

function delCookie(label) {
	if (getCookie(label)) {
		document.cookie = label + "=; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}


// FUNÇÃO DE CONVERSÃO DE MAIUSCULAS/MINUSCULAS
// ----------------------------------------------------------------------------
function smallCaps(obj, type) {
		type = ((typeof type != "number") || (type > 3) || (type < 1)) ? 3 : type;
		var except = ['de','do','da','das','dos','em'];
		var tam = obj.value.length;
		var txt = obj.value;
		switch (type) {
			case 1: txt = txt.toLowerCase(); break;
			case 2: txt = txt.toUpperCase(); break;
			case 3: if (tam > 0) {
								txt = txt.toLowerCase().split(' ');
								for (var x = 0; x < txt.length; x++)
									if (!inArray(txt[x],except) && (txt[x].length > 1))
										txt[x] = txt[x].substring(0,1).toUpperCase() + txt[x].substring(1,txt[x].length);
								txt = txt.join(' ');
							}; break;
		};
		obj.value = txt;
}

function inArray(txt, array) {
	var ret = false;
	for (var x=0; x<array.length; x++)
		if (array[x] == txt)
			ret = true;
	return ret;
}


// ALTERA COR DE UM OBJETO
// ----------------------------------------------------------------------------
function mudacor(prmThis,prmName)	{
	if ((window.document.all) || (window.document.getElementById))
		prmThis.className = prmName;
	else if (window.document.layers)
		prmThis.className = prmName;
}


// JUMP MENU
// ----------------------------------------------------------------------------
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// MENSAGEM NA BARRA DE STATUS
// ----------------------------------------------------------------------------
function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

//===============================================================================
//= FORMULÁRIOS E BUSCAS ========================================================
//===============================================================================
var tipo = 0;

function FaleConosco() {
	tipo = 1;
	document.form1.action = "mail.asp";
	document.form1.method = "post";
}

function Newsletter() {
	tipo = 2;
	document.form1.action = "newsletter-action.asp";
	document.form1.method = "post";
}

function Busca() {
	tipo = 3;
	document.form1.action = "";
	document.form1.method = "get";
}

function AcessoRestrito() {
	tipo = 4;
	document.form1.action = "../acessorestrito/login.asp";
	document.form1.method = "post";
}

function AlterarSenha() {
	tipo = 5;
	document.form1.action = "../acessorestrito/alterar-action.asp";
	document.form1.method = "post";
}

function RevendaForm() {
	tipo = 6;
	document.form1.action = "mail.asp";
	document.form1.method = "post";
}

function RepresentaForm() {
	tipo = 7;
	document.form1.action = "mail.asp";
	document.form1.method = "post";
}

function VFaleConosco() {
	if (!document.form1.nome.value) { alert("Por favor, informe seu nome."); document.form1.nome.focus(); return false; };
  if (!VEmail( document.form1.email.value)) { alert("O seu e-mail não é válido!\nVerifique-o novamente."); document.form1.email.focus(); return false; };
  if (!document.form1.cidade.value) { alert("Por favor, informe a cidade."); document.form1.cidade.focus(); return false; };
  if (!document.form1.mensagem.value) { alert("Você deve escrever a mensagem."); document.form1.mensagem.focus(); return false; };
  return true;
}
function VRevenda() {
	if (!document.form1.nome.value) { alert("Por favor, informe seu nome."); document.form1.nome.focus(); return false; };
  if (!VEmail( document.form1.email.value)) { alert("O seu e-mail não é válido!\nVerifique-o novamente."); document.form1.email.focus(); return false; };
  if (!document.form1.telefone.value) { alert("Por favor, informe seu telefone."); document.form1.telefone.focus(); return false; };
  if (!document.form1.cep.value) { alert("Por favor, informe seu CEP."); document.form1.cep.focus(); return false; };
  if (!document.form1.endereco.value) { alert("Por favor, informe seu endereço."); document.form1.endereco.focus(); return false; };
  if (!document.form1.cidade.value) { alert("Por favor, informe a cidade."); document.form1.cidade.focus(); return false; };  
  if (!document.form1.estado.value) { alert("Por favor, informe seu estado."); document.form1.estado.focus(); return false; };
  if (!document.form1.razaosocial.value) { alert("Por favor, informe sua razão social."); document.form1.razaosocial.focus(); return false; };
  if (!VCNPJ( document.form1.cnpj.value)) { alert("O seu CNPJ não é válido!\nVerifique-o novamente."); document.form1.cnpj.focus(); return false; };
  if (!document.form1.inscricaoestadual.value) { alert("Por favor, informe sua inscrição estadual."); document.form1.inscricaoestadual.focus(); return false; };
  if (!document.form1.nomec01.value) { alert("Por favor, informe o nome do primeiro contato."); document.form1.nomec01.focus(); return false; };
  if (!document.form1.telefonec01.value) { alert("Por favor, informe o telefone do primeiro contato."); document.form1.telefonec01.focus(); return false; };
  if (!document.form1.nomec02.value) { alert("Por favor, o nome do segundo contato."); document.form1.nomec02.focus(); return false; };
  if (!document.form1.telefonec02.value) { alert("Por favor, informe o telefone do segundo contato."); document.form1.telefonec02.focus(); return false; };  
  if (!document.form1.banco.value) { alert("Por favor, informe o nome do seu banco."); document.form1.banco.focus(); return false; };  
  if (!document.form1.telefoneb.value) { alert("Por favor, informe o telefone do seu banco."); document.form1.telefoneb.focus(); return false; };    
  if (!document.form1.pessoacontato.value) { alert("Por favor, informe o nome do contato no banco."); document.form1.pessoacontato.focus(); return false; };    
  return true;
}
function VRepresenta() {
	if (!document.form1.nome.value) { alert("Por favor, informe seu nome."); document.form1.nome.focus(); return false; };
  if (!VCPF( document.form1.cpf.value)) { alert("O seu CPF não é válido!\nVerifique-o novamente."); document.form1.cpf.focus(); return false; };
  if (!VEmail( document.form1.email.value)) { alert("O seu e-mail não é válido!\nVerifique-o novamente."); document.form1.email.focus(); return false; };
  if (!document.form1.cidade.value) { alert("Por favor, informe a cidade."); document.form1.cidade.focus(); return false; };  
  if (!document.form1.estado.value) { alert("Por favor, informe seu estado."); document.form1.estado.focus(); return false; };
  if (!document.form1.telefone.value) { alert("Por favor, informe seu telefone."); document.form1.telefone.focus(); return false; };
  if (!document.form1.idade.value) { alert("Por favor, informe sua idade."); document.form1.idade.focus(); return false; };
  if (!document.form1.automovel.value) { alert("Por favor, informe seu automóvel."); document.form1.automovel.focus(); return false; };
  if (!document.form1.ano.value) { alert("Por favor, informe o ano do seu automóvel."); document.form1.ano.focus(); return false; };
  return true;
}
function VNewsletter() {
	if (!document.form1.newsnome.value) { alert("Por favor, informe seu nome."); document.form1.newsnome.focus(); return false; };
  if (!VEmail(document.form1.newsemail.value)) { alert("O seu e-mail não é válido!\nVerifique-o novamente."); document.form1.newsemail.focus(); return false; };
  return true;
}

function VBusca() {
	if (!(document.form1.busca.value.length > 1)) { alert("Informe um número maior de caracteres para busca."); document.form1.busca.focus(); return false; };
	return true;
}

function VAcessoRestrito() {
  if (document.form1.login.value == "") { alert("Por favor, informe seu Login."); document.form1.login.focus(); return false; };
  if (document.form1.senha.value == "") { alert("Por favor, informe a Senha."); document.form1.senha.focus(); return false; };
  return true;
}

function VAlterarSenha() {
  if (document.form1.asenha.value == "") { alert("Por favor, informe a Senha atual."); document.form1.asenha.focus(); return false; };
  if (document.form1.nsenha.value == "") { alert("Por favor, informe a nova Senha."); document.form1.nsenha.focus(); return false; };
  if (document.form1.csenha.value == "") { alert("Por favor, confirme a sua nova Senha."); document.form1.csenha.focus(); return false; };
  if (document.form1.nsenha.value != document.form1.csenha.value) { alert("As Senhas digitadas não coincidem."); document.form1.nsenha.focus(); return false; };
  return true;
}


function EnviaFormulario() {
	switch(tipo) {
		case 1: return VFaleConosco(); break;
		case 2: return VNewsletter(); break;
		case 3:	if (VBusca()) { document.location.href="busca.asp?busca=" + document.form1.busca.value; } break;
		case 4: return VAcessoRestrito();
		case 5: return VAlterarSenha();
		case 6: return VRevenda(); break;
		case 7: return VRepresenta(); break;
		
	}
	return false;
}


//===============================================================================
//= MASCARAS ====================================================================
//===============================================================================
/* 
	Mascara para Campos.
	"#" - Numeros
	"A" - Letras UpperCase
	"a" - Letras LowerCase
	"Z" - Letras
	"*" - Qualquer Caracter
	"/", ".", "-", " ", ":" - Caracteres Fixos

	USO:
	somente números
		onKeyPress="if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;"
		
		onKeyUp="mascara_hora(this.value)"
*/

function Mascara(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;
}

/// SOMENTE NÚMEROS
// ----------------------------------------------------------------------------
function trimToDigits(string) {
	s = "";
	var Numeros = /\d/;
	for (i = 0; i <= string.length; i++) 
		if (Numeros.test(string.substr(i,1))) s += string.substr(i,1);
	return s;	
}

/// VERIFICA E-MAIL
// ----------------------------------------------------------------------------
function VEmail( strEmail ) {
     var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
     return (filter.test(strEmail));
}

/// VERIFICA ANO
// ----------------------------------------------------------------------------
function VAno(ano) {
	ano = trimToDigits(ano);
	return ((parseInt(ano) < 1900) || (ano.length != 4) || (parseInt(ano) > 2050)) ? false : true; 
}

/// VERIFICA MÊS
// ----------------------------------------------------------------------------
function VMes(mes) {
	mes = trimToDigits(mes);
	return ((mes.length != 2) || (parseInt(mes) < 1) || (parseInt(mes) > 12)) ? false : true; 
}

/// VERIFICA MÊS/ANO
// ----------------------------------------------------------------------------
function VMesAno(data) {
	data = trimToDigits(data);
	if (data.length < 6) return false;
	mes = data.substr(0,2);
	ano = data.substr(2,4);
	return (!VAno(ano) || !VMes(mes)) ? false : true;
}

/// VERIFICA DATA
// ----------------------------------------------------------------------------
function VData(data) {
	data = trimToDigits(data);
	if (data.length < 8) return false;
	dia = data.substr(0,2);
	mes = data.substr(2,2);
	ano = data.substr(4,4);
	
	if(ano >= 0 && ano < 1900) return false; 
	if(ano > 2100 || ano < 0 || mes > 12 || mes < 1) return false; 
	numero = ((parseInt(ano) - 1884) / 4) 
	dias = (numero == Math.floor(numero)) ? "312931303130313130313031" : "312831303130313130313031"; 
	diamax = parseInt(dias.substring((mes - 1) * 2, ((mes - 1) * 2) + 2)); 
	if(dia < 1 || dia > diamax) return false; 	
	
	return true;
}

/// VERIFICA CPF
// ----------------------------------------------------------------------------
function VCPF(cpf) {
	cpf = trimToDigits(cpf);
	if (cpf.length < 11) return false;
	valor = true;
	if (cpf == "00000000000" || cpf == "11111111111" || 
			cpf == "22222222222" || cpf == "33333333333" || 
			cpf == "44444444444" || cpf == "55555555555" || 
			cpf == "66666666666" || cpf == "77777777777" || 
			cpf == "88888888888" || cpf == "99999999999") return false;

	var a = [];
	var b = new Number;
	var c = 11;
	for (i = 0; i < 11; i++) {
		a[i] = cpf.charAt(i);
		b = (i < 9) ? b + (a[i] *  --c) : b;
	}
	
	a[9] = ((x = b % 11) < 2) ? 0 : 11 - x;

	b = 0;
	c = 11;
	for (y = 0; y < 10; y++) b += (a[y] *  c--); 
	a[10] = ((x = b % 11) < 2) ? 0 : 11 - x;

	return (cpf.charAt(9) == a[9]) && (cpf.charAt(10) == a[10]);
}	

/// VERIFICA CNPJ
// ----------------------------------------------------------------------------
function VCNPJ(cnpj) {
	cnpj = trimToDigits(cnpj);
	if (cnpj.length < 14) return false;
	m2 = 2;		
	soma1 = 0;
	soma2 = 0;
	for ( i = 11; i >= 0; i--) {
		val = eval(cnpj.charAt(i));
		m1 = m2;
		if (m2 < 9) { m2++ }
	 	else { m2 = 2 }
		soma1 = soma1 + (val * m1)
		soma2 = soma2 + (val * m2)
  }
	soma1 = soma1 % 11
	if (soma1 < 2) { d1 = 0 }
  else { d1 = 11 - soma1}
	soma2 = (soma2 + (2 * d1)) % 11
	if (soma2 < 2) { d2 = 0 }
  else { d2 = 11 - soma2}
	return (cnpj.charAt(12) == d1) && (cnpj.charAt(13) == d2);
}

function MaskAno(objeto, evt) { 
	return Mascara(objeto, evt, '####');
}

function MaskMesAno(objeto, evt) { 
	return Mascara(objeto, evt, '##/####');
}

function MaskCEP(objeto, evt) { 
	return Mascara(objeto, evt, '##.###-###');
}

function MaskTelefone(objeto, evt) { 
	return Mascara(objeto, evt, '(##) ####-####');
}

function MaskCPF(objeto, evt) { 
	return Mascara(objeto, evt, '###.###.###-##');
}

function MaskCNPJ(objeto, evt) { 
	return Mascara(objeto, evt, '##.###.###/####-##');
}

function MaskData(objeto, evt) { 
	return Mascara(objeto, evt, '##/##/####');
}

function MaskData2(objeto, evt) { 
	return Mascara(objeto, evt, '##/##/##');
}

function MaskHora(objeto, evt) { 
	return Mascara(objeto, evt, '##:##');
}

function MaskHora2(objeto, evt) { 
	return Mascara(objeto, evt, '##:##:##');
}
// FUNÇÃO DO AJAX
// ----------------------------------------------------------------------------
function ajaxInit() {
	var req;
	
	try {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	} catch(e) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(ex) {
			try {
				req = new XMLHttpRequest();
			} catch(exc) {
				alert("Esse browser não tem recursos para uso do Ajax");
				req = null;
			}
		}
	}
	return req;
};

function LoadAjax(metodo, url, send, destino, loadshow, loadcontent, loaddestino, janela) {
	var ajax = ajaxInit();	
	if(ajax) {  
		if(metodo == "post") {  
				ajax.open("POST", url, true);  
				ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
		} else {
				ajax.open("GET", url + "?rnd="+ Math.random() +"&"+ send, true);  
		}
		ajax.onreadystatechange = function() { 
																if (ajax.readyState == 1) {
																	if (loadshow == 2) {
																		document.getElementById(loaddestino).innerHTML = loadcontent;
																	};
																}
																if (ajax.readyState == 4) {
																	if (ajax.status == 200) {
																		var resultado = ajax.responseText; // Coloca o retornado pelo Ajax nessa variável 
																		resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4) 
																		resultado = unescape(resultado); // Resolve o problema dos acentos 
																		if (loadshow == 2) {
																			document.getElementById(loaddestino).innerHTML = '';
																		};
																		if (janela != 2) {
																			document.getElementById(destino).innerHTML = resultado;
																		} else {
																			opener.document.getElementById(destino).innerHTML = resultado;
																			setTimeout("window.close()", 1000);
																		};
																	};
																}
															}  
			
		if(metodo == "post") {  
			ajax.send(send);  
		} else {  
			ajax.send(null);  
		}  
	}  
}

// FUNÇÃO DE CARREGAR PARCEIROS COM AJAX
// ----------------------------------------------------------------------------
function LoadParceiros(estado) {
	var url = 'lista.asp';
	var send = 'uf=' + estado;
	var destino = 'parceiroestado'; //local de retorno do conteúdo
	var loadshow = 1; //2 = exibe    <> de 2 = não exibe loading
	var loadcontent = ''; //conteúdo de loading
	var loaddestino = ''; //destino do conteúdo de loading
	var janela = 1; //1 = mesma janela    2 ou > = janela opener	
	LoadAjax("get", url, send, destino, loadshow, loadcontent, loaddestino, janela);
}

//FUNÇÃO DE CARREGAR AS FOTOS DOS PRODUTOS
//-----------------------------------------------------------------------------
function MostraImagens(codigo,categoria) {
	var url = 'ajx_imagens.asp';
	var send = 'cod='+codigo+'&cat='+categoria;
	var destino = 'ajx-produtosFotos'; //local de retorno do conteúdo
	var loadshow = 2; //2 = exibe    <> de 2 = não exibe loading
	var loadcontent = '<img src="../imagens/ajax-loader.gif" alt=""/>'; //conteúdo de loading
	var loaddestino = 'ajx-produtosFotos'; //destino do conteúdo de loading
	var janela = 1; //1 = mesma janela    2 ou > = janela opener
	LoadAjax("get", url, send, destino, loadshow, loadcontent, loaddestino, janela);
}

//--------------------------------------------------------------------
// SUBMENUS
//--------------------------------------------------------------------
var tempoesconde = new Array();

function Esconde(id) {
	document.getElementById(id).style.display = "none";
}

function EscondeF(id) {
	tempoesconde[id] = setTimeout("Esconde('"+id+"')", 400);
}

function Mostra(id) {
	if (typeof(tempoesconde[id]) != 'undefined')
		clearTimeout(tempoesconde[id]);

	document.getElementById(id).style.display =  "";
}
//--------------------------------------------------------------------

// FUNÇÃO EXIBE/OCULTA ELEMENTOS
// ----------------------------------------------------------------------------
function ExibeEsconde(id) {
	document.getElementById(id).style.display = document.getElementById(id).style.display == 'none' ? '' : 'none';
}

