$(function(){

	var msTabs = $('#story .gallery-tab > ul.gallery-tb');

    // Initialize Main Story Tabs				
	msTabs.tabs(
			   defaults = {   
             navClass: 'gallery-tb',
 			 selectedClass: 'active',
             panelClass: 'gallery-container',
             hideClass: 'hide',
             fx: { opacity: 'toggle', duration: 'normal' }
         }
    );
    // Initialize Rotation at 5.5 seconds
    msTabs.tabs('rotate', 5500);
    
    // This is the Main Story Tabs Play function at 5.5 seconds
	$('ul.gallery-play .play').click(function() {
		msTabs.tabs('rotate', 5500);
	});
	
	// This is the Main Story Tabs Stop function
	$('ul.gallery-play .stop').click(function() {
		msTabs.tabs('rotate', null);
	});
    
    // Initialize Content Tabs 				
	$('#box-tabs > ul.box-tab').tabs(
			   defaults = {   
             navClass: 'box-tab',
 			 selectedClass: 'active',
             panelClass: 'tab-content',
             hideClass: 'hide',
             fx: { opacity: 'toggle', duration: 'normal' }
         }
    );
    
    // This activates the "fancybox" plugin
	$('.photo-link').fancybox({ 'zoomSpeedIn': 500, 'zoomSpeedOut': 500, 'overlayShow': true });
	
	// Image gallery fading
	// set opacity to 60% on page load
	$('#box-tabs img').css("opacity",".6");
	// on mouse over full opacity
	$('#box-tabs img').hover(function () {
		$(this).stop().animate({
			opacity: 1
		}, 400);
	},
	// on mouse out 60% opacity
	function () {
		// animate opacity to nill
		$(this).stop().animate({
			opacity: .6
		}, 400);
	});
    

});