$(function() {
	
	$('a.gallery-btn').overlay({
		target: '#box',
		mask:{ color: '#000', opacity: 0.8}
	});

// thumbnail scrollable
	$("#thumbnails").scrollable().find("img").click(function(){
		if ($(this).hasClass("active")) { return; }
		var url = $(this).attr("src").replace("width=53", "width=370").replace("height=53", "height=370");
		var alt = $(this).attr("alt");
		
		var wrap = $("#image");
		
			wrap.find("img").attr("src", url);
			wrap.find("img").attr("alt", alt);
			wrap.find("h6").html(alt);
	
		
		// activate item
		$(".items img").removeClass("active");
		$(this).addClass("active");
		
		
	});
	
	// enable tooltips for the images
	$("#image div img").tooltip({
		position: "bottom center",
		offset: [-78, 0],
		opacity: 0.8,
		effect: 'fade',
		// position tooltips relative to the parent elements
		relative: true
	});
	
	$('#box').appendTo('body');
});