$(document).ready(function(){
	sombra_fotos();
	
	$(".highslide").click( function() {
		return hs.expand(this, { easing: 'easeOutBack', easingClose: 'easeInBack' } )
	});

	hs.graphicsDir = 'js/graphics/';
	hs.outlineType = 'rounded-white';
	hs.captionEval = 'this.thumb.alt';
	hs.showCredits =  false;
	hs.minWidth = 300;
	hs.outlineWhileAnimating = true;
	hs.objectLoadTime = 'after';
	hs.padToMinWidth = true;

	hs.registerOverlay({ // remove this to disable the controlbar
		slideshowGroup: null,
		overlayId: 'controlbar',
		position: 'top right',
		hideOnMouseOut: true,
		useOnHtml: true,
		dimmingOpacity: 0.5,
		align: 'center',
		transitions: ['expand', 'crossfade']
	});
	
	if (typeof(Tooltip) == 'function') {
	  $('#fotos a').Tooltip({ showURL: false });
	}

	
	$('#fotos a').each(function() {
		var titulo = $(this).attr("title").substr(0,13);
		titulo = $(this).attr("title").length >= 16 ? titulo + '...' : titulo;
		$(this).append("<h4>" + titulo + "</h4>");
	});
	$("#textos>[@id^=a0]").hide();
	$("#textos>[@id^=la0]").click(function (){
		$("#" + this.id.substr(1,this.id.length)).slideToggle();
		return false;
	});
	$('.ocultar').click(function() {
		$('#testimonio_mail').slideToggle();		
		return false;
	});

	var con_paginacion = $("body").attr("class");
	if ( con_paginacion == "con_paginacion" ) {
		$("#pagination").pagination($('#number_items').val(), {
			items_per_page:20, 
			callback: paginacion_callback
		});
	}
});
function sombra_fotos() {
	$('.thumbtable a').each(function(index){
		var $this = $(this);
		$this.wrap( ('<div class="thumbshadow1"><div class="thumbshadow2"><div class="thumb"></div></div></div>') );
	})
}

function paginacion_callback(page_id, jq) {
	$('#firmas_rs').text("Mostrando resultados del "+((page_id*10)+1)+"-"+((page_id*10)+10));
	var script = $('#script').val();
	$("#galeria").load(script + ".php",{action: "listar", page: page_id}, sombra_fotos);
	return false;
}

