$(function(){
	var IE = $.browser.msie ? $.browser.version : false;

	$(document).pngFix();
	$('#bannersTopo ul li :first').css({'margin-right':'5px'});
	
	/*if(IE && IE < 8)
		$('.imgLink').lightBox({txtImage: 'Imagem', txtOf: 'de', overlayOpacity: 0.5});
	else
		$("a[rel^='prettyPhoto']").prettyPhoto({opacity: 0.50, hideflash: true, iframe: true, allowresize: true, modal:true});*/
		
	$("a[rel^='noticiaFoto']").fancybox();
	$("a[rel^='galeriaFoto']").fancybox();
	$("a[rel^='comentar']").fancybox({ width:600, height:400, type:'iframe'});
		
	$("div#cot-agricola").load("/inc/cotacao.php");
	$('#fontsize').fontSize({
		alvo: '#texto',
		opResetar: true,
		tipoPaiLink: 'ul'
	});
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	var options={
        utc: true,
        utc_offset: -4
      };
    $('.relogio').jclock(options);
	$("#enqueteAjax").load('/inc/enquete.php');
	$("#enqResultado").live("click", function() {
		$.ajax({ 
			url: "/inc/enquete.php",
			type: "GET",
			//beforeSend: mostraLoad('enquete'),
			data: 'resultado=true',
			cache: false,
			success: function(conteudo){
				$('#enqueteAjax').html(conteudo);
			}
		});
	});
	$("#enqVoltar").live("click", function() {
		$.ajax({ 
			url: "/inc/enquete.php",
			type: "GET",
			//beforeSend: mostraLoad('enquete'),
			cache: false,
			success: function(conteudo){
			  $('#enqueteAjax').html(conteudo);
			}
		});
	});
	$("#enqEnvia").live("click", function() {
		var dados = $("#myForm").serialize();
		$.ajax({ 
			url: "/inc/enquete.php",
			type: "POST",
			//beforeSend: mostraLoad('enquete'),
			data: dados,
			cache: false,
			success: function(conteudo){
		  		$('#enqueteAjax').html(conteudo);
			}
		});
		return false;
	});
});

function updateHTML(elmId, value) {
	document.getElementById(elmId).innerHTML = value;
}
function loadVideo(videoID) {
	if(ytplayer) {
		ytplayer.cueVideoById(videoID);
	}
}
function pegaDescricao(id) {
	$("#tituloVideo").load("/inc/videosDescricao.php div#titulo", {idplayer: id}); 
	$("#descricaoVideo").load("/inc/videosDescricao.php div#descri", {idplayer: id});
}
function onPlayerError(errorCode) {
	alert("An error occured of type:" + errorCode);
}

function onYouTubePlayerReady(playerId) {
	ytplayer = document.getElementById("ytPlayer");
	ytplayer.addEventListener("onError", "onPlayerError");
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

var horoscopo = function(id)
{
	window.open("http://www.chacras.com.br/astral/pop_previsao.html?signo="+id, "SIGNOS", "width=415, height=270");
};
