//window.onbeforeunload = function(){ return 'leave this page?';};

$(function(){
	
	if($("a[rel^=lightbox]").size()){
		// fancybox initialization
		$("a[rel^=lightbox]").fancybox({
		   	"titlePosition"		: 'inside',
		   	"overlayOpacity"	: 0.8,
			"overlayColor"		: '#000000',
			'transitionIn'	: 'elastic',		
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts){
				var text = '';
				if(currentArray.length > 1) text = '<strong>' + title + '</strong>' + 'Image ' +  (currentIndex + 1) + ' of ' + currentArray.length;
			    return '<span id="fancybox-title-inside">'+ text + '</span>';
			}
		});
	}

});
