// Início do código de Aumentar/ Diminuir a letra
 
// Para usar coloque o comando: "javascript:mudaTamanho('tag_ou_id_alvo', -1);" para diminuir
// e o comando "javascript:mudaTamanho('tag_ou_id_alvo', +1);" para aumentar
 
var tagAlvo = new Array('p'); //pega todas as tags p//
 
// Especificando os possíveis tamanhos de fontes, poderia ser: x-small, small...
var tamanhos = new Array( '9px','10px','11px','12px','13px','14px','15px' );
var tamanhoInicial = 2;
 
function mudaTamanho( idAlvo,acao ){
  if (!document.getElementById) return
  var selecionados = null,tamanho = tamanhoInicial,i,j,tagsAlvo;
  tamanho += acao;
  if ( tamanho < 0 ) tamanho = 0;
  if ( tamanho > 6 ) tamanho = 6;
  tamanhoInicial = tamanho;
  if ( !( selecionados = document.getElementById( idAlvo ) ) ) selecionados = document.getElementsByTagName( idAlvo )[ 0 ];
  
  selecionados.style.fontSize = tamanhos[ tamanho ];
  
  for ( i = 0; i < tagAlvo.length; i++ ){
    tagsAlvo = selecionados.getElementsByTagName( tagAlvo[ i ] );
    for ( j = 0; j < tagsAlvo.length; j++ ) tagsAlvo[ j ].style.fontSize = tamanhos[ tamanho ];
  }
}
// Fim do código de Aumentar/ Diminuir a letra

/* LIMPAR CAMPO */
function EmptyField(objeto, msg){
	if(objeto.value == msg)objeto.value = '';
}
function ShowField(objeto, msg){
	if(objeto.value == '')objeto.value = msg;
}

/* FAVORITOS */
function addFavoritos(url,title){
		if (window.sidebar) window.sidebar.addPanel(title, url,"");
		else if(window.opera && window.print){
			var mbm = document.createElement('a');
			mbm.setAttribute('rel','sidebar');
			mbm.setAttribute('href',url);
			mbm.setAttribute('title',title);
			mbm.click();
		}
		else if(document.all){
			window.external.AddFavorite(url, title);
	}
}

/* MENU REGIÕES */
abrirRegioes = function(){
	if(document.all && document.getElementById){
		navRoot = document.getElementById("abrirRegioes");
		for(i = 0; i < navRoot.childNodes.length; i++){
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI"){
				node.onmouseover = function(){
					this.className+=" over";
				}
				node.onmouseout = function(){
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}

/* TITULOS DESTAQUES */
$(document).ready(function(){
	$("#abrirMenu li").hover(function(){
		$(this).addClass("over");
	},function(){
		$(this).removeClass("over");
	});
});

/* MENU SECOES */
$(document).ready(function(){
	$("ol.titulo_destaque li").hover(function(){
		$(this).addClass("over");
	},function(){
		$(this).removeClass("over");
	});
});


/* PUBLICIDADES */
/* DHTML */
function fechaDHTML(){
	document.getElementById('dhtml').style.visibility = "hidden";
}
/* SKY */
function fechaSKY(){
	document.getElementById('sky').style.visibility = "hidden";
}

/* BOTAO CADASTRAR */
$(document).ready(function(){
	$("input.btn_cadastrar").hover(function(){
		$(this).addClass("over");
	},function(){
		$(this).removeClass("over");
	});
});

/* POP UP */
// onclick="MM_openBrWindow('url.php','OPS','width=100,height=100')"
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* REQUISIÇÃO */
function devolveRq(){
	try{
		rq = new XMLHttpRequest();
	}
	catch(erro1){
		try{
			rq = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(erro2){
			try{
				rq = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(erro3){
				window.alert('Seu navegador não tem suporte a Ajax');
				rq = false;
			}
		}
	}
	return rq;
}
var ajax = devolveRq();

/* LINKS PATROCINADOS */
function atualizaLinks(){
	var rand = parseInt(Math.random()*999999999999);
	var url = "http://www.ops.com.br/_inc/links.php?r="+rand+"&atualiza=1";
	ajax.open("GET", url, true);
	ajax.onreadystatechange = RespostaLinks;
	ajax.send(null);
}

function RespostaLinks(){
	if(ajax.readyState == 4){
		if(ajax.status == 200){
			var Resp = ajax.responseText;
			document.getElementById("atualizaLinks").innerHTML = Resp;
		}else{
			window.alert('ERRO: '+ ajax.statusText);
		}
	}else{
		document.getElementById("atualizaLinks").innerHTML = "<img src='images/loading.gif' alt='' border='0' width='50' height='50' style='margin:5px 70px;' /><p style='font-size:10px; font-weight:bold; text-align:center;'>Carregando...</p>";
	}
}
/* SEND NEWS */
function sendNews(){
	var rand = parseInt(Math.random()*999999999999);
	var mail = document.getElementById("email_news").value;
	var url = "_inc/newsletter.php?r="+rand+"&acao=1&email_news="+mail;
	ajax.open("GET", url, true);
	ajax.onreadystatechange = RespostaNews;
	ajax.send(null);
}

function RespostaNews(){
	if(ajax.readyState == 4){
		if(ajax.status == 200){
			var Resp = ajax.responseText;
			document.getElementById("include_newsletter").innerHTML = Resp;
		}else{
			window.alert('ERRO: '+ ajax.statusText);
		}
	}else{
		document.getElementById("include_newsletter").innerHTML = "<div style='text-align:center;'><img src='images/loading.gif' alt='' border='0' width='50' height='50' /><p style='font-size:10px; font-weight:bold; text-align:center;'>Carregando...</p></div>";
	}
}
/* NOTICIAS */
function includeNoticia(editoria){
	var rand = parseInt(Math.random()*999999999999);
	var opcao = editoria;
	var url = "_inc/noticias.php?r="+rand+"&editoria="+opcao;
	ajax.open("GET", url, true);
	ajax.onreadystatechange = RespostaNoticia;
	ajax.send(null);
}

function RespostaNoticia(){
	if(ajax.readyState == 4){
		if(ajax.status == 200){
			var Resp = ajax.responseText;
			document.getElementById("moda").innerHTML = Resp;
		}else{
			window.alert('ERRO: '+ ajax.statusText);
		}
	}else{
		document.getElementById("moda").innerHTML = "<div style='text-align:center;'><img src='images/loading.gif' alt='' border='0' width='50' height='50' /><p style='font-size:10px; font-weight:bold; text-align:center;'>Carregando...</p></div>";
	}
}

/*
 * PAGINACAO
 */
function paginacao(pagina,pag,editoria){
	var rand = parseInt(Math.random()*999999999999);
	var pagina = pagina;
	var pag = pag;
	var editoria = editoria;
	var url = pagina+".php?r="+rand+"&pag="+pag+"&editoria="+editoria;
	ajax.open("GET", url, true);
	ajax.onreadystatechange = RespostaPaginacao;
	ajax.send(null);
}

function RespostaPaginacao(){
	if(ajax.readyState == 4){
		if(ajax.status == 200){
			var Resp = ajax.responseText;
			document.getElementById("paginacao").innerHTML = Resp;
		}else{
			window.alert('ERRO: '+ ajax.statusText);
		}
	}else{
		document.getElementById("paginacao").innerHTML = "<div style='text-align:center;'><img src='../images/loading.gif' alt='' border='0' width='50' height='50' /><p style='font-size:10px; font-weight:bold; text-align:center;'>Carregando...</p></div>";
	}
}

/* AUTO COMPLETAR SHOPPING LATERAL */
function lookup_2(busca) {
	if(busca.length == 0) {
		$('#suggestions_2').hide();
	} else {
		$.post("_inc/search_shopping.php", {queryString: ""+busca+""}, function(data){
			if(busca.length >0) {
				$('#suggestions_2').show();
				$('#autoSuggestionsList_2').html(data);
			}
		});
	}
}

function fill_2(thisValue) {
	$('#busca').val(thisValue);
	setTimeout("$('#suggestions_2').hide();", 200);
}

/* SHOPPING OPS - ANUNCIOS */
function atualizaShopping(){
	var rand = parseInt(Math.random()*999999999999);
	var url = "http://www.ops.com.br/_inc/shopping.php?r="+rand+"&atualizash=1";
	ajax.open("GET", url, true);
	ajax.onreadystatechange = RespostaShopping;
	ajax.send(null);
}

function RespostaShopping(){
	if(ajax.readyState == 4){
		if(ajax.status == 200){
			var Resp = ajax.responseText;
			document.getElementById("atualizaShopping").innerHTML = Resp;
		}else{
			window.alert('ERRO: '+ ajax.statusText);
		}
	}else{
		document.getElementById("atualizaShopping").innerHTML = "<img src='images/loading.gif' alt='' border='0' width='50' height='50' style='margin:5px 70px;' /><p style='font-size:10px; font-weight:bold; text-align:center;'>Carregando...</p>";
	}
}

/* FUNÇÃO DA BARRA FIXA */





