/* Author:  Celtic Shadows Design 
*/
$(document).ready(function(){ 
/* Gallery Buttons */
		var $portfolioItem = jQuery('.showcase-th');
		$portfolioItem.find('.imgWrapper').css('background-color','#333');
		$('.zoom-icon, .more-icon').css('display','block').css('opacity','0');/* Enable buttons if JS allowed 		*/
		
		$portfolioItem.hover(function(){
			jQuery(this).find('.imgWrapper').stop().animate({top: -15}, 500).find('img.portfolio').stop().animate({opacity: 0.6},500);
			jQuery(this).find('.zoom-icon').stop().animate({opacity: 1, left: 40},400);
			jQuery(this).find('.more-icon').stop().animate({opacity: 1, left: 120},400);
		}, function(){
			jQuery(this).find('.zoom-icon').stop().animate({opacity: 0, left: 30},400);
			jQuery(this).find('.more-icon').stop().animate({opacity: 0, left: 130},400);
			jQuery(this).find('.imgWrapper').stop().animate({top: 0}, 500).find('img.portfolio').stop().animate({opacity: 1},500);
		});
		/* Navigation System */
        $("ul.sf-menu").supersubs({ 
            minWidth:    6,   // minimum width of sub-menus in em units 
            maxWidth:    12,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason. 
	/* Featured Carousel */
	$('#featured').cycle({
		fx: 'fade',
		easein: 'easein',
		speed:  4000 
	});
						 

// Fancybox lightbox settings
	$("a.fancybox").fancybox({
	  'transitionIn'	: 'none',
	  'transitionOut'	: 'none',
	  'titlePosition'   : 'over',
	  'overlayOpacity'	: 0.7,
	  'overlayColor'	: '#000000',
	  'zoomSpeedIn'		: 500,
	  'zoomSpeedOut'	: 500,
	  'titleFormat'		: function (title, currentArray, currentIndex, currentOpts) {
	  return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
	}
	});
$('#galleria').galleria({
		lightbox: true,
		 width: 780,
         height: 540,
         debug: false,         
		extend: function() {
			this.attachKeyboard({
    			left: this.prev, // applies the native prev() function
    			right: this.next
          	 })
	       }    
    	});
});
