﻿jQuery().ready( function()
{
    var onMouseOutOpacity = 0.5;
	$('#folio-items ul.thumbs li').opacityrollover(
	{
		mouseOutOpacity:   onMouseOutOpacity,
		mouseOverOpacity:  1.0,
		fadeSpeed:         'fast',
		exemptionSelector: '.selected'
	});

    var gallery = $('#folio-items').galleriffic(
    {
        imageContainerSel:      '#slideshow',
		controlsContainerSel:   '#controls',
		captionContainerSel:    '#caption',
		playLinkText:           'Play slideshow',
		pauseLinkText:          'Pause slideshow',
		prevLinkText:              '&lsaquo; Prev',
        nextLinkText:              'Next &rsaquo;',
		renderSSControls:       true,
		onSlideChange:          function(prevIndex, nextIndex) 
		{
			// 'this' refers to the gallery, which is an extension of $('#thumbs')
			this.find('ul.thumbs').children()
				.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
				.eq(nextIndex).fadeTo('fast', 1.0);
			// Update the photo index display
			this.find('div#photo-index').html((nextIndex+1) +'/'+ this.data.length);
		},
		onPageTransitionOut:       function(callback) {
			this.fadeTo('fast', 0.0, callback);
		},
		onPageTransitionIn:        function() {
			this.fadeTo('fast', 1.0);
		}

    });
    
    $('#folio-items ul.thumbs').hide();
    //$('#gallery-nav').hide();
    $('#gallery').hover(
    function()
    {
	    //$('#gallery-nav').slideDown();
    },
    function()
    {
	    //$('#gallery-nav').slideUp();
    });
});
