$(document).ready(function(){
	
	
	//galeria home
	$("a[rel=galeria]").fancybox({
		"titlePosition":"over",
		"titleFormat":function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Imagem ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	//galeria de vídeo home
	$("a[rel=video]").fancybox({
		"titleShow":false
	});
	
	//charge
	$("a[rel=charge]").click(function(){
		tamanho1 = parseInt($(this).attr("tamanho1")) + 17;
		tamanho2 = parseInt($(this).attr("tamanho2")) + 91 + 8 + 17;
		$.fancybox({
			"width":tamanho1,
			"height":tamanho2,
			"titlePosition":"over",
			"href":this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			"type":"iframe",
			"titleFormat":function() {
				return false;
			}
		});
		return false;		
	});
	
	//agenda
	$("a[rel=agenda]").fancybox({
		"overlayShow": true,
		/*"showNavArrows": false,*/
		"titleFormat": function(){
			return false;	
		}
	});
	
	//charge
	$("a[rel=charges]").fancybox({
		"overlayShow": true,
		/*"showNavArrows": false,*/
		"titleFormat": function(){
			return false;	
		}
	});
	
	//imagens listar
	seletor = "";
	$(".listaImagem").each(function(){
		caminho = $(this).find("a:first").attr("rel");
		seletor += "a[rel="+caminho+"],";
	});
	seletor = seletor.substring(0, seletor.length-1);
	$(seletor).fancybox({
		"titlePosition":"over",
		"titleFormat":function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Imagem ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
});
