/* Mais topicos home */
maisTopicos = function() {
$jQ(".mais-topicos .bt-mais-topicos").click(function() {
  if ($jQ(".mais-topicos-container").is(":visible")){
    $jQ(".mais-topicos-container").hide();
  }
  else {
    $jQ(".mais-topicos-container").show();
  }
  return false;
});
$jQ(".mais-topicos-container").mouseover(function(){
    $jQ(this).stop(true, true).show();
});
$jQ(".mais-topicos-container").mouseout(function(){
    $jQ(this).stop(true, true).hide();
});
}

/* Fotolog */
/* Javascript para funcionalidades do template do INFO */
var INFO = {
	isIE: function() {
		/*@cc_on return true; @*/
		return false;
	},
	isIE6: function() {
		/*@cc_on @if (@_jscript_version <= 5.6) return true; @end @*/
		return false;
	},
	isIE7: function() {
		/*@cc_on @if (@_jscript_version > 5.6) return true; @end @*/
		return false;
	}
};
INFO.DESTAQUE = {
	totalChannels: null,
	currentChannel: null,
	currentOpacity: null,
	opacityIncrement: null,
	rotatePaused: false,
	opacitySteps: 10,


	init: function(total, start) {
		//jslog.info("total: "+total+", start: "+start);
		this.totalChannels = total;
		this.currentChannel = start;
		this.changeChannel(start);
	},

    hiddenObjectUno: function(){
        document.getElementById("btTV0").style.display="none";
        document.getElementById("bt-esq").style.display="none";
        document.getElementById("bt-dir").style.display="none";
    },
    
    changeOpacity: function(element, opacity) {
		try {
			if (INFO.isIE6()) {
				element.style.filter = "alpha(opacity="+opacity+")";
			} else if (INFO.isIE7()) {
				element.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity+")";
			} else {
				var floatOpacity = (opacity/100);
				element.style.opacity = floatOpacity;
				element.style.MozOpacity = floatOpacity;
				element.style.KhtmlOpacity = floatOpacity;
			}
		} catch (e) {
		}
	},

	calculateOpacity: function(id, start, end, opacity) {
		try {
			if (opacity == undefined) {
				INFO.DESTAQUE.currentOpacity = start;
			} else {
				INFO.DESTAQUE.currentOpacity = opacity;
			}
			if (INFO.DESTAQUE.opacityIncrement == null) {
				INFO.DESTAQUE.opacityIncrement = Math.round((end-start)/INFO.DESTAQUE.opacitySteps);
			}
			INFO.DESTAQUE.changeOpacity(document.getElementById(id), INFO.DESTAQUE.currentOpacity);
			INFO.DESTAQUE.currentOpacity += INFO.DESTAQUE.opacityIncrement;
			if (INFO.DESTAQUE.currentOpacity <= end) {
				setTimeout("INFO.DESTAQUE.calculateOpacity('"+id+"', "+start+", "+end+", "+INFO.DESTAQUE.currentOpacity+")", 50);
			}
		} catch (e) {
		}
	},

	rotateChannel: function(time) {
		tTV = window.setInterval("INFO.DESTAQUE.changeChannel('rotate')", time * 1000);
	},
	
	clearRotateChannel: function() {
		clearInterval(tTV);
		INFO.DESTAQUE.rotateChannel(tempoCanais);
	},	

	pauseRotate: function(pause) {
		if (pause == true) {
			INFO.DESTAQUE.rotatePaused = true;
		} else {
			INFO.DESTAQUE.rotatePaused = false;
		}
	},

	changeChannel: function(ch) {
		if(!isNaN(ch)){
			this.currentChannel = ch;
		} else {
			if(ch == "previous") {
				//jslog.info("user clicked on number");
				this.currentChannel--;
				if(this.currentChannel < 0) this.currentChannel = (this.totalChannels-1);
			} else if(ch == "next") {
				//jslog.info("user clicked next");
				this.currentChannel++;
				if(this.currentChannel >= this.totalChannels) this.currentChannel = 0;
			} else if(ch == "rotate" && !this.rotatePaused) {
				//jslog.info("rotate mode");
				this.currentChannel++;
				if(this.currentChannel >= this.totalChannels) this.currentChannel = 0;
			} else {
				return false;
			}
		}

		//jslog.info("changing channel to "+this.currentChannel);

		for(i=0;i<this.totalChannels;i++){
			if(i == this.currentChannel){
				if(document.getElementById("scrTV"+i).className == "oas"){
					document.getElementById("modTV").style.display="none";
					if(document.getElementById("modOAS")) document.getElementById("modOAS").style.display="block";
					document.getElementById("controle").style.display="none";
				} else {
					if(document.getElementById("modOAS")) document.getElementById("modOAS").style.display="none";
					document.getElementById("modTV").style.display="block";
					document.getElementById("controle").style.display="block";
				}
				document.getElementById("scrTV"+i).style.display="block";
        document.getElementById("txt"+i).style.display="block";
        //document.getElementById("fundo"+i).style.display="block";
        document.getElementById("bt"+i).className="marcSelecionado";
				this.calculateOpacity("imgTV"+i, 0, 100);
				this.calculateOpacity("txt"+i, 0, 100);
        //this.calculateOpacity("fundo"+i, 0, 70);
			} else {
				document.getElementById("scrTV"+i).style.display="none";
				document.getElementById("txt"+i).style.display="none";
        //document.getElementById("fundo"+i).style.display="none";
        document.getElementById("bt"+i).className="marcador";
        //document.getElementById("chTV"+i).style.display="none";
        //document.getElementById("btTV"+i).className="";
			}
		}
		return false;
	}

};
