// JavaScript Document

$(document).ready(function() {
				$("a[rel=gallery]").fancybox({
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					console.log(currentArray);
					
					return '<span id="fancybox-title-over"><span class="imageno">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + ' </span> ' + (title.length ? ' ' + title : '') + '</span>';
				}
			});
	$(".gallery a span").ready(function(){
    
	$(".gallery a span").animate({opacity:"0",speed:"fast"});
	$('.gallery a span').css( 'width', $('.gallery a span').parent().find('img').outerWidth());
	$('.gallery a span').css( 'height', $('.gallery a span').parent().find('img').outerHeight());
	 $('.gallery a span').parent().css( 'width', $('.gallery a span').parent().find('img').outerWidth());
	 $('.gallery a span').parent().css( 'height', $('.gallery a span').parent().find('img').outerHeight());
	
	
	
	});
	
	$(".gallery a").hover(function() {
		$(this).find('span').addClass("hover").stop()
			.animate({
        opacity: '0.70'
			}, 100);
		
		} , function() {
		$(this).find('span').removeClass("hover").stop()
			.animate({
        opacity: '0'
			}, 100);
	});
	
	/* Pajinate Script */
	$('.gallerywrapper').each(function(){
		$(this).pajinate({
			num_page_links_to_display : 5,
			items_per_page : 3	
		});
	});
			
			
		});
