// Inicio requisita email pra liberar anuncio //
function chamado()
{
location.href = "chamado.asp"
}
// Fim requisita email pra liberar anuncio //

// Inicio caixa cental final (Bares, restaurantes, teatros, praias) //
var req;

function load_xml(url)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = carrega;
        req.open("GET", url, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = carrega;
            req.open("GET", url, true);
            req.send();
        }
    }
}

function carrega()
{
    // apenas quando o estado for "completado"
    document.getElementById('aba_conteudo').innerHTML = "<div align='center'><b>Carregando...</b></div>";
    if (req.readyState == 4) {
        // apenas se o servidor retornar "OK"
        if (req.status == 200) {
            // procura pela div id="resultado" e insere o conteudo
            // retornado nela, como texto HTML
            document.getElementById('aba_conteudo').innerHTML = req.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req.statusText);
        }
    }
}
//---------- Inicio Bar ----------//
function bar()
{
    load_xml("barra_centro_inferior.asp?op=bar");
	document.getElementById("aba_conteudo").style.border="4px solid #065A96";
	document.getElementById("noticia").style.width="92px";
	document.getElementById("bar").style.width="84px";
	document.getElementById("praia").style.width="92px";
	document.getElementById("recomendamos").style.width="92px";
	document.getElementById("teatro").style.width="92px";
}
//---------- Fim Bar ----------//
//---------- Inicio Restaurante ----------//
function noticia()
{
    load_xml("barra_centro_inferior.asp?op=restaurante");
	document.getElementById("aba_conteudo").style.border="4px solid #E56004";
	document.getElementById("noticia").style.width="84px";
	document.getElementById("bar").style.width="92px";
	document.getElementById("praia").style.width="92px";
	document.getElementById("recomendamos").style.width="92px";
	document.getElementById("teatro").style.width="92px";
}

//---------- Fim Restaurante ----------//
//---------- Inicio Teatro ----------//
function praia()
{
    load_xml("barra_centro_inferior.asp?op=praia");
	document.getElementById("aba_conteudo").style.border="4px solid #81AD00";
	document.getElementById("noticia").style.width="92px";
	document.getElementById("bar").style.width="92px";
	document.getElementById("praia").style.width="84px";
	document.getElementById("recomendamos").style.width="92px";
	document.getElementById("teatro").style.width="92px";
}
//---------- Fim Teatro ----------//
//---------- Inicio Recomendamos ----------//
function recomendamos()
{
    load_xml("barra_centro_inferior.asp?op=recomendamos");
	document.getElementById("aba_conteudo").style.border="4px solid #869AAC";
	document.getElementById("noticia").style.width="92px";
	document.getElementById("bar").style.width="92px";
	document.getElementById("praia").style.width="92px";
	document.getElementById("recomendamos").style.width="84px";
	document.getElementById("teatro").style.width="92px";
}
//---------- Fim Recomendamos ----------//
//---------- Inicio Teatro ----------//
function teatro()
{
    load_xml("barra_centro_inferior.asp?op=teatro");
	document.getElementById("aba_conteudo").style.border="4px solid #E0BF07";
	document.getElementById("noticia").style.width="92px";
	document.getElementById("bar").style.width="92px";
	document.getElementById("praia").style.width="92px";
	document.getElementById("recomendamos").style.width="92px";
	document.getElementById("teatro").style.width="84px";
}
//---------- Fim Teatro ----------//
// Fim caixa cental final (Bares, restaurantes, teatros, praias) //

// Inicio cores barra topo //
function sul()
{
	document.getElementById("bt_sul").style.background="#FF0000";
	document.getElementById("bt_sudeste").style.background="#ffffff";
	document.getElementById("bt_norte").style.background="#ffffff";
	document.getElementById("bt_nordeste").style.background="#ffffff";
	document.getElementById("bt_centro-oeste").style.background="#ffffff";
	document.getElementById("bt_cadastro").style.background="#ffffff";
	document.getElementById("bt_barra").style.background="#FF0000";
}
function sudeste()
{
	document.getElementById("bt_sul").style.background="#ffffff";
	document.getElementById("bt_sudeste").style.background="#E56004";
	document.getElementById("bt_norte").style.background="#ffffff";
	document.getElementById("bt_nordeste").style.background="#ffffff";
	document.getElementById("bt_centro-oeste").style.background="#ffffff";
	document.getElementById("bt_cadastro").style.background="#ffffff";
	document.getElementById("bt_barra").style.background="#E56004";
}
function norte()
{
	document.getElementById("bt_sul").style.background="#ffffff";
	document.getElementById("bt_sudeste").style.background="#ffffff";
	document.getElementById("bt_norte").style.background="#81AD00";
	document.getElementById("bt_nordeste").style.background="#ffffff";
	document.getElementById("bt_centro-oeste").style.background="#ffffff";
	document.getElementById("bt_cadastro").style.background="#ffffff";
	document.getElementById("bt_barra").style.background="#81AD00";
}
function nordeste()
{
	document.getElementById("bt_sul").style.background="#ffffff";
	document.getElementById("bt_sudeste").style.background="#ffffff";
	document.getElementById("bt_norte").style.background="#ffffff";
	document.getElementById("bt_nordeste").style.background="#F7D41A";
	document.getElementById("bt_centro-oeste").style.background="#ffffff";
	document.getElementById("bt_cadastro").style.background="#ffffff";
	document.getElementById("bt_barra").style.background="#F7D41A";
}
function centrooeste()
{
	document.getElementById("bt_sul").style.background="#ffffff";
	document.getElementById("bt_sudeste").style.background="#ffffff";
	document.getElementById("bt_norte").style.background="#ffffff";
	document.getElementById("bt_nordeste").style.background="#ffffff";
	document.getElementById("bt_centro-oeste").style.background="#065A96";
	document.getElementById("bt_cadastro").style.background="#ffffff";
	document.getElementById("bt_barra").style.background="#065A96";
}
function cadastro()
{
	document.getElementById("bt_sul").style.background="#ffffff";
	document.getElementById("bt_sudeste").style.background="#ffffff";
	document.getElementById("bt_norte").style.background="#ffffff";
	document.getElementById("bt_nordeste").style.background="#ffffff";
	document.getElementById("bt_centro-oeste").style.background="#ffffff";
	document.getElementById("bt_cadastro").style.background="#4497C8";
	document.getElementById("bt_barra").style.background="#4497C8";
}



// Fim cores barra topo //

// Inicio Aumenta-Diminui fonte
var tam=12;
function fonte(x) {
tam+=x;
if(tam>16) tam=16;
if(tam<10) tam=10;
document.all.texto.style.fontSize=tam;
}
// Fim Aumenta-Diminui fonte


// Inicio abre foto do anuncio
<!--
function abrir_img(url) {
var url = url + ""
	var NS = (document.layers) ? true : false;
	var IE = (document.all) ? true : false;
if(NS) {
window.open(url,"","scrollbars=no,menubar=no,personalbar=no,screenX=10,screenY=10");
}
 else if(IE) {
window.open(url,"","scrollbars=no,menubar=no,personalbar=no,left=10,top=10");
}
}
//-->
// Fim abre foto do anuncio


// Inicio habilita botao cadastro
function valida_termo() {
var checkbox=document.getElementById("aceito").checked;
if(checkbox == true) {
document.getElementById("termo").disabled=false;
}
else
{
document.getElementById("termo").disabled=true;
}
}
// Fim habilita botao cadastro

// =====================================
// bloqueia clique botao dir.
// =====================================

if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu() {
event.cancelBubble = true, event.returnValue = false;
 return false;
}
function norightclick(e) {
if (event.button == 2 || event.button == 3) {
event.cancelBubble = true, event.returnValue = false;
return false;
}
}
if (document.layers)
document.captureEvents(Event.MOUSEDOWN);
document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
document.onmouseup = norightclick;

// =====================================
// INICIO edita rapido
// =====================================
var ipb_var_base_url      = "";
var newer_topics     = new Array;
var newer_count      = 0;
var flags_count      = 0;
var start_int        = 0;
var forum_mark_sent  = 0;
var span_html        = new Array;
var desc_html        = new Array;
var text_html        = new Array;
var folders          = new Array;
var _desc_clicked    = 0;
var topic_links_init = 0;

var tid_date    = new Array();
var click_delay = 500; //microseconds (1.2 seconds)

function forum_init_topic_links()
{
	var pagelinks = document.getElementsByTagName('a');
	
	for ( var i = 0 ; i <= pagelinks.length ; i++ )
	{
		try
		{
			if ( ! pagelinks[i].id )
			{
				continue;
			}
		}
		catch(e)
		{
			continue;
		}
		
		var linkid   = pagelinks[i].id;
		var linkname = linkid.replace( /^(.*)-(\d+)$/, "$1" );
		
		if ( linkname == 'tid-link' )
		{
			pagelinks[i].onmousedown  = topic_link_event_mousedown;
			
		}
	}
	
	topic_links_init = 1;
}

/*--------------------------------------------*/
// Mousedown, start timer
/*--------------------------------------------*/

function topic_link_event_mousedown( event )
{
	var tid = _get_tid_from_id( this.id );
	tid_date[ tid ] = _get_time_now();
	setTimeout( "topic_link_event_timer("+tid+")", 5 );
}

function topic_link_event_timer( tid )
{
	var timenow = _get_time_now();
	if ( timenow > 0 && tid_date[tid] > 0 && ( (timenow - tid_date[tid] ) > click_delay ) )
	{
		tid_date[tid] = 0;
		span_to_input( tid );
		return false;
	}

	if ( tid_date[tid] > 0 )
	{
		setTimeout( "topic_link_event_timer("+tid+")", 5 );
	}
}



function _get_time_now()
{
	var mydate = new Date();
	return mydate.getTime();
}



function _get_tid_from_id( id )
{
	return id.replace( /.*\-(\d+)/, "$1" );
}



function span_to_input( tid )
{
	
	span_html[ tid ] = document.getElementById( 'tid-span-' + tid ).innerHTML;
	text_html[ tid ] = document.getElementById( 'tid-link-' + tid ).innerHTML;
//	document.getElementById( 'tid-span-' + tid ).innerHTML = '<input id="edit-'+tid+'" class="dny-edit-title" value="'+text_html[ tid ].replace( /"/g, '&quot;') +'" />'; 
	document.getElementById('tid-span-'+ tid ).innerHTML = '<textarea id="edit-'+tid+'" class="dny-edit-title">'+text_html[ tid ].replace( /<br ?\/?>/gim, "\n" ) +'</textarea>';
	document.getElementById( 'edit-' + tid ).onblur        = function( event ) { tid_blur(tid) }

}


tid_blur = function( tid, type )
{
	new_text = document.getElementById( 'edit-' + tid ).value;
		if ( new_text != "" )
		{
			tid_save( tid, new_text, type );
		}
}

/*--------------------------------------------*/

tid_save = function( tid, new_text, type )
{
	{
		document.getElementById( 'tid-span-' + tid ).innerHTML = span_html[ tid ];
		document.getElementById( 'tid-link-' + tid ).innerHTML = new_text;
		forum_init_topic_links();
	}
}

// =====================================
// FIM edita rapido
// =====================================
