/**
 * @author by
 */

//console.log('dsss');

$(document).ready(function() {
		
			// open thumbs in new window
			$('div#thumbs_list li a').click(function(){
				// console.debug('whoo');
				window.open(this.href);
				return false;
			});
					
            // We only want these styles applied when javascript is enabled
            $('div.navigation').css({
                'width': '300px',
                'float': 'left'
            });
            $('div.content').css('display', 'block');
            
            // Initially set opacity on thumbs and add
            // additional styling for hover effect on thumbs
            var onMouseOutOpacity = 1.0;
            $('#thumbs ul.thumbs li').css('opacity', onMouseOutOpacity).hover(function(){
                $(this).not('.selected').fadeTo('slow', 1.0);
            }, function(){
                $(this).not('.selected').fadeTo('slow', onMouseOutOpacity);
            });
       
			
			// Initialize Advanced Galleriffic Gallery
                var galleryAdv = $('#gallery').galleriffic('#thumbs', {
                    delay: 5000,
                    numThumbs: 12,
                    preloadAhead: 10,
                    enableTopPager: true,
                    enableBottomPager: true,
                    imageContainerSel: '#slideshow',
                    controlsContainerSel: '#controls',
                    captionContainerSel: '#caption',
                    loadingContainerSel: '#loading',
                    renderSSControls: true,
                    renderNavControls: true,
                    playLinkText: 'Play Slideshow',
                    pauseLinkText: 'Pause Slideshow',
                    prevLinkText: '&lsaquo; Previous Photo',
                    nextLinkText: 'Next Photo &rsaquo;',
                    nextPageLinkText: 'Next &rsaquo;',
                    prevPageLinkText: '&lsaquo; Prev',
                    enableHistory: false,
                    autoStart: true,
                    onChange: function(prevIndex, nextIndex){
                        $('#thumbs ul.thumbs').children().eq(prevIndex).fadeTo('slow', onMouseOutOpacity).end().eq(nextIndex).fadeTo('slow', 1.0);
                    },
                    onTransitionOut: function(callback){
                        $('#caption').fadeTo('slow', 0.0);
                        $('#slideshow').fadeTo('slow', 0.0, callback);
                    },
                    onTransitionIn: function(){
                        $('#slideshow').fadeTo('slow', 1.0);
                        $('#caption').fadeTo('slow', 1.0);
                    },
                    onPageTransitionOut: function(callback){
                        $('#thumbs ul.thumbs').fadeTo('slow', 0.0, callback);
                    },
                    onPageTransitionIn: function(){
                        $('#thumbs ul.thumbs').fadeTo('slow', 1.0);
                    }
                });

		// tom cunningham tom@kargo.com
		// change to make main slideshow image clickable 
		// and for it to go to "Looks We Love" category (category id 21)

		$('#container').click(function(){ window.location = '/category.php?id_category=21'; });


            });
