$.fn.cycle.defaults.timeout = 6000;
function popup(file,w,h){
	var l = Math.round(screen.width/2-w/2);
	var t = Math.round(screen.height/2-h/2);
	window.open(file, "radio", "width="+w+",height="+h+",top="+t+",left="+l);
}
function mostraGaleria(galeria){
	popup(galeria, 600, 450);
}
function carregaPesquisa(){
	// Obtém o ID da enquete a ser exibida
	$.get('pesquisa.php?getID', function(eqID){

		if($.cookie('p')==eqID){
			$("#pesquisa").load('ssi_pesquisa_resultado.php');
		}else{
			$("#pesquisa").load('ssi_pesquisa_form.php',function(){
				$("#pesquisaEnviar").click(function(){
					var s = $(this.form).serialize();
					$("#pesquisa").load('ssi_pesquisa_resultado.php?'+s);			
				});		
			});
		}		

	});
}
$(function() {
	if(("#pesquisa").length > 0){
		carregaPesquisa();
	}	
	$('#s1').cycle({		
		fx:     'fadeZoom', 
	    easing: 'easeOutBounce', 
	    delay:  -1000
	});
	$('#btPrev').click(function(){
		$('#s1').cycle('prev');
		return false;
	});
	$('#btNext').click(function(){
		$('#s1').cycle('next');
		return false;
	});	
	$('#btAoVivo').click(function(){
		popup('/player_aovivo.html', 280, 180); 
		return false;
	});
	$('#btFavoritos').jFav();	
	$('a[rel|=lightbox]').lightBox({
		overlayOpacity: 0.6,
		imageLoading: '/images/lightbox-ico-loading.gif',
		imageBtnClose: '/images/lightbox-btn-close.gif',
		imageBtnPrev: '/images/lightbox-btn-prev.gif',
		imageBtnNext: '/images/lightbox-btn-next.gif',
		txtImage: 'Imagem',
		txtOf: 'de'
	});	
	$('.scrool').jScrollPane({
		showArrows:true
	});
	$('.mostraGaleria').click(function(){
		mostraGaleria($(this).attr('href'));
		return false; 
	});
});