<!--

////////////////////////////// AJAX /////////////////////////////////
function openAjax()
{ 
	var Ajax; 
	try
	{
		Ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers mais populares, como: Firefox, Safari, dentre outros. 
	}
	catch(ee) 
	{ 
		try
		{
			Ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS 
		}
		catch(e)
		{ 
			try
			{
				Ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS 
			}
			catch(e)
			{
				Ajax = false; 
			} 
		} 
	} 
	return Ajax; 
} 

function carregaAjax(id, pagina, metodo)
{ 
	if(document.getElementById)  // Para os browsers complacentes com o DOM W3C.
	{ 
		var exibeResultado = document.getElementById(id); // div que exibirá o resultado. 
		var Ajax = openAjax(); // Inicia o Ajax. 
		
		Ajax.open(metodo, pagina, true); // fazendo a requisição 
		
		Ajax.onreadystatechange = function() 
		{ 
			if(Ajax.readyState == 1) // Quando estiver carregando, exibe: carregando...
			{ 
				exibeResultado.innerHTML = "<div style='width:80px; height:18px; background-color:#CC3300; padding-left:2px; padding-top:1px;'><font color='#FFFFFF'>Carregando...</font></div>"; 
			} 
			
			if(Ajax.readyState == 4) // Quando estiver tudo pronto. 
			{
				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 
					exibeResultado.innerHTML = resultado; 
				}
				else
				{ 
					exibeResultado.innerHTML = "<div align='center'><strong>Erro: Problemas com a conexão.</strong></div>"; 
				} 
			} 
		} 
	Ajax.send(null); // submete 
	} 
} 
/////////////////////////////////////////////////////////////////////


// MENUS DO LAYOUT //////////////////////////////////////////////////
	function MENU_OVER( td_id, img_id )
	{
		var td_mudar = document.getElementById(td_id); 
		td_mudar.style.background = 'url(../_img/layout_fundo_01_hover.gif)';
		td_mudar.style.cursor = 'pointer';
		
		var img_mudar = document.getElementById(img_id); 
		img_mudar.src = '../_img/layout_menu_bullet_01_hover.gif';
	}
	
	function MENU_OUT( td_id, img_id )
	{
		var td_mudar = document.getElementById(td_id); 
		td_mudar.style.background = 'url()';
		
		var img_mudar = document.getElementById(img_id); 
		img_mudar.src = '../_img/layout_menu_bullet_01.gif';
	}
	
	function BANNER_OVER( td_id, numero )
	{
		var td_mudar = document.getElementById(td_id); 
		td_mudar.style.background = 'url(../_img/layout_banner_botao_'+numero+'_hover.gif)';
		td_mudar.style.cursor = 'pointer';
	}
	
	function BANNER_OUT( td_id, numero )
	{
		var td_mudar = document.getElementById(td_id); 
		td_mudar.style.background = 'url(../_img/layout_banner_botao_'+numero+'.gif)';
	}
/////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////
// FUNÇÃO PARA LIMPAR O INPUT              //
function input_limpar( elm )
{
	if (!elm.base) 
		elm.base = elm.value
		
	if (elm.value == elm.base) 
		elm.value = "";
	else if (elm.value == "") 
		elm.value = elm.base;
}
/////////////////////////////////////////////

///////// POSICIONA LAYER DE ESCURIDÃO NO CENTRO //////////
//var site_escuro = false;
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var espaco_foto = 200;

function Posiciona_EscureceSite()
{
	nome_div = "div_site_escuro";
	with(document.getElementById(nome_div).style) 
	{
		width = document.body.clientWidth+"px";
		height = document.body.clientHeight+"px";

		position = 'absolute';
	}
	

	nome_div = "div_site_escuro_destaque";
	with(document.getElementById(nome_div).style) 
	{
		vLeft = ((document.body.clientWidth - parseInt(width)) / 2)-40;
		vTop = (( document.body.clientHeight - ((parseInt(height)*2))) / 2 )- espaco_foto; //parseInt(height);//200;
		position = 'absolute';
		
		if (is_chrome)
		{
			left = (document.body.scrollLeft + vLeft)+"px";
			top = (document.body.scrollTop + vTop)+"px";
		}else{
			left = (document.documentElement.scrollLeft + vLeft)+"px";
			top = (document.documentElement.scrollTop + vTop)+"px";
		}
	}
	
	setTimeout("Posiciona_EscureceSite()",10);
}

window.onload = function()
{
	Posiciona_EscureceSite();
	document.body.style.overflow	= 'hidden';
	document.body.style.overflow	= '';
}

function EscureceSite(condicao)
{
	nome_div = "div_site_escuro";
	nome_div_caixa = "div_site_escuro_destaque";
	
	if (condicao == true)
	{
		document.getElementById(nome_div).style.display = 'block';
		document.getElementById(nome_div_caixa).style.display = 'block';
		document.body.style.overflow	= 'hidden';
	}
	else
	{
		document.getElementById(nome_div).style.display = 'none';
		document.getElementById(nome_div_caixa).style.display = 'none';
		document.body.style.overflow	= '';
	}
}

function Escurece(condicao)
{
	nome_div = "div_site_escuro";
	
	if (condicao == true)
	{
		document.getElementById(nome_div).style.display = 'block';
	}
	else
	{
		document.getElementById(nome_div).style.display = 'none';
	}
}

function  MudaFoto(foto, id)
{
	nome_div = "div_imagem";
	document.getElementById(nome_div).style.background = 'url(../_img/carregando.gif) center #FFFFFF';
	document.getElementById(nome_div).style.background = 'url(../_arquivos_fotos/'+foto+') bottom left no-repeat #FFFFFF';
	carregaAjax("div_desc", "../fotos/ajax_descricao.asp?ID="+id, "GET");
}
/////////////////////////////////////////////////////////////


/////////////////////////////////////////////
// FUNÇÃO MENU OVER - mudar estilo         //
function muda_classe(objeto,classe)
{
	objeto.className = classe;
}
/////////////////////////////////////////////

/////////////////////////////////////////////
// FUNÇÃO FOTO OVER E OUT - muda imagem    //
function muda_thumb(imagem,objeto)
{
	objeto.style.background = "url(../_arquivos_fotos/"+imagem+") no-repeat";
}
/////////////////////////////////////////////

/////////////////////////////////////////////////
// Para mudar páginas em record sets paginados //
function muda_pagina()
{
	var valor = document.getElementById('paginas').value;
	document.location.href = valor;
}
/////////////////////////////////////////////////

function botao_google_muda_cor(objeto, cor, decoracao, texto, linque)
{
	objeto.style.color 				= texto;
	objeto.style.backgroundColor 	= cor;
	objeto.style.textDecoration 	= decoracao;
	window.status 					= linque;
}

////////////////// CRIA BOTÃO DO GOOGLE ///////////////////
function criar_botao(texto,imagem,largura,altura,cor_fundo,cor_fundo_over,clique,status)
{
	if (status=="")
	{
		str_clique = clique.replace("document.location.href='","");
		str_clique = str_clique.replace("';","");
		str_clique = str_clique.replace("'","");
	}else{
		str_clique = status;
	}
	
	document.write("<div class=\"botao_google_01\" style=\"width:"+largura+"px; height:"+altura+"px; background-color:"+cor_fundo+"; text-align:center; float:left;\" onmouseover=\"botao_google_muda_cor(this, '"+cor_fundo_over+"', 'underline', '#000', '"+str_clique+"');\" onmouseout=\"botao_google_muda_cor(this, '"+cor_fundo+"', 'none', '#555', '');\" onclick=\""+clique+"\">");
	document.write("<div class=\"botao_google_02\"><div class=\"botao_google_03\"><div class=\"botao_google_04\"></div><div class=\"botao_google_05\"></div></div><div class=\"botao_google_09\">");
	
	if (imagem != "")
		document.write("<img src=\""+imagem+"\" align=\"left\" />");
	
	document.write(texto);
	
	document.write("</div><div class=\"botao_google_06\"><div class=\"botao_google_07\"></div><div class=\"botao_google_08\"></div></div></div>");
	document.write("</div>");
}
/////////////////////////////////////////////////////////////

// CADASTRO ANTES DE DOWNLOAD
function abre_cadastro(url)
{
	//alert(document.body.scrollTop);
	fundo = document.getElementById('div_cadastro_fundo');
	fundo.style.height = document.body.clientHeight;
	//fundo.style.width = document.body.clientWidth;
	fundo.style.display = 'block';
	fundo.style.top = document.body.scrollTop+'px';
	caixa = document.getElementById('div_cadastro_link');
	caixa.style.display = 'block';
	
	//alert(document.documentElement.clientHeight);
    caixa.style.left = ((document.body.clientWidth/2)-140)+'px';
    caixa.style.top = ((document.documentElement.clientHeight/2)-100)+'px';
	
	
	//caixa.style.top = (event.clientY-100)+'px';
	//caixa.style.left = (event.clientX-100)+'px';
	document.getElementById('down_url').value = url;
}

function verifica_pais(objeto,valor_aceito,obj_select)
{
	caixa_estados = document.getElementById(obj_select);
	
	if (objeto.value.toLowerCase() != valor_aceito && objeto.value.toLowerCase() != valor_aceito+' ')
	{
		caixa_estados.disabled = true;
	}else{
		caixa_estados.disabled = false;
	}
}
/////////////////////////////////////////////////////////////

// para mudar os botões over e out //////////////////////////
function muda_aceso(objeto,sufixo)
{
	valor_atual = objeto.src;
	
	if (sufixo=="on")
		valor_atual = valor_atual.replace("_off.", "_on.");
	else
		valor_atual = valor_atual.replace("_on.", "_off.");
	
	objeto.src = valor_atual;
}
/////////////////////////////////////////////////////////////

-->
