var InicialDestaque = 0;
var tempoExibicao = 4;
var tempoExibicaoTv = 4;
var NotAtual = 0;
var qtoTv;
var tTV;
var tTVd=0;
function TrocaDestaqueDia(){
$("#mycarousel .tv-1:visible").slideUp('slow');
$("#mycarousel .tv-1:eq("+InicialDestaque+")").slideDown('slow');
}

function MudaDestaqueTempo(){
if(InicialDestaque == (qtoTv-1)){
InicialDestaque = 0;
}else{
InicialDestaque = InicialDestaque+1;	
}
TrocaDestaqueDia();
}

function MudaDestaqueTempoVoltar(){	
if(InicialDestaque == (qtoTv-1) || InicialDestaque <= 0){
InicialDestaque = 0;
}else{
InicialDestaque = InicialDestaque-1;	
}
TrocaDestaqueDia();
}

function AcaoTv(ch){
if(ch == "previous") {
MudaDestaqueTempoVoltar();
} else if(ch == "next") {
MudaDestaqueTempo();
} else {
return false;
}}

function LigaTempo(){
tTVd=null;
tTVd = window.setInterval(MudaDestaqueTempo, tempoExibicaoTv * 1000);
}
function DesligaTempo(){
	if(tTVd){window.clearTimeout(tTVd);tTVd=null;}
}

function TVexecute(){
MudaDestaqueTempo();
LigaTempo();
}

function ExecNews(){
$("#noticiasDisplay ul li").hide();
$("#noticiasDisplay ul li:eq("+NotAtual+")").show();
}

function MudaNews(){
if(NotAtual == (QtoNews-1)){
NotAtual = 0;	
}else if(NotAtual == -1){
NotAtual = QtoNews-1;
}else{
NotAtual = NotAtual+1;	
}
 ExecNews();
}

function MudaNewsVoltar(){
if(NotAtual == (QtoNews-1)){
NotAtual = 0;	
}else if(NotAtual == -1){
NotAtual = QtoNews-1;
}else{
NotAtual = NotAtual+1;	
}
 ExecNews();
}

function AcaoNews(ch){
if(ch == "previous") {
MudaNews();
} else if(ch == "next") {
MudaNewsVoltar();
} else {
return false;
}}

function LigaTempoNews(){
tTV = window.setInterval("MudaNews()", tempoExibicao * 1000);
}
function DesligaTempoNews(){
clearInterval(tTV);
}

function Newsexecute(){
	$("#noticiasDisplay ul").show();
MudaNews();
tTV = window.setInterval("MudaNews()", tempoExibicao * 1000);
}

// Ativa TV E NEWS

//$("#mycarousel").hover(function(){DesligaTempo();},function(){LigaTempo();});
//$("#web-noticias").hover(function(){DesligaTempoNews();},function(){LigaTempoNews();});

TVexecute();
Newsexecute();

$(document).ready(function(){
var Item = 1;
var itens = "";
$.ajax({
type: "GET",
url: "pmv/mais_lidas.json",
cache: false,
contentType:"application/json; charset=utf-8",
dataType: "json",
success: function(json){
$.each(json.lista, function(i,lista){
itens += "<p><strong>"+Item+"&nbsp;-&nbsp;</strong> <a href=" + json.lista[i].url + ">" + json.lista[i].titulo + "</a><\/p>";
Item++;
});
$("#boxMaisLidos").html(itens);
}
});
});

var nuvem = "";

$(document).ready(function() {	
$.ajax({
type: "GET",
url: "libc/busca/most-popular/novaescolasppublished_top_query.xml",
dataType: "xml",
success: function(xml) {

$(xml).find('top-query').each(function(i){
var palavra = $(this).attr('query');
var NumeroQuery = eval($(this).attr('num-queries'));

if(i<20){
if(NumeroQuery<=20){font=8;}
if(NumeroQuery>=21 && NumeroQuery<=40){font=11;}
if(NumeroQuery>=41 && NumeroQuery<=60){font=15;}
if(NumeroQuery>=61 && NumeroQuery<=80){font=19;}
if(NumeroQuery>=81 && NumeroQuery<=100){font=25;}
if(NumeroQuery>=101 && NumeroQuery<=120){font=30;}
if(NumeroQuery>=121 && NumeroQuery<=140){font=35;}
if(NumeroQuery>=141){font=40;}

$("#NuvemTag p").append(' <a href="template-busca.shtml@qu=' + escape(palavra) + '" target="_parent"  style="font-size:'+font*0.85+'px'+'">'+palavra+'</a> ');

}
NumeroQuery=0;
}); //fecha each(

}
}); //fecha $.ajax(
}); //fecha 


        
  
        function mostra(num){
	if(document.getElementById('mostrar_' + num).style.display == "none"){
		document.getElementById('mostrar_' + num).style.display = "block";
	}
	else {
		document.getElementById('mostrar_' + num).style.display = "none";
	}
}
    function enquete(){
	if(document.getElementById('resultados').style.display == "none"){
		document.getElementById('resultados').style.display = "block";
	}
	else {
		document.getElementById('resultados').style.display = "none";
	}
}

        function mostraAluno(){
	if(document.getElementById('aluno').style.display == "none"){
		document.getElementById('aluno').style.display = "block";
	}
	else {
		document.getElementById('aluno').style.display = "none";
	}
}

        function mostraProfessor(){
	if(document.getElementById('professores').style.display == "none"){
		document.getElementById('professores').style.display = "block";
	}
	else {
		document.getElementById('professores').style.display = "none";
	}
}

