// JQuery slide li's - For "Who's Exhibiting"
$(document).ready(function() {
        
        var auto_slide = 1;
        var hover_pause = 0;
        
        var auto_slide_seconds = 6;
        
        $('#carousel_ul li:first').before($('#carousel_ul li:last')); 
        
        if(auto_slide == 1){
            var timer = setInterval('slide("right")', auto_slide_seconds); 
            
            $('#hidden_auto_slide_seconds').val(auto_slide_seconds);
        }
  
        if(hover_pause == 1){
            $('#carousel_ul').hover(function(){
                clearInterval(timer)
            },function(){
                timer = setInterval('slide("right")', auto_slide_seconds); 
            });
  
        }
});

function slide(where){
    
            var item_width = $('#carousel_ul li').outerWidth() + 10;

            if(where == 'left'){

                var left_indent = parseInt($('#carousel_ul').css('left')) + item_width;
            }else{

                var left_indent = parseInt($('#carousel_ul').css('left')) - item_width;
            
            }
            
            $('#carousel_ul:not(:animated)').animate({'left' : left_indent},6000,function(){    
                
                if(where == 'left'){

                    $('#carousel_ul li:first').before($('#carousel_ul li:last'));
                }else{

                    $('#carousel_ul li:last').after($('#carousel_ul li:first')); 
                }

                $('#carousel_ul').css({'left' : '-150px'});
            });
}

// JQuery for the slideshow - variables given in index.php
$(function() {
            setInterval(Slider, 5000);
        });

        function Slider() {
        $('#slideshow img').fadeTo("slow", 0.1, function() {
            $(this).attr('src', imgs[(imgs.length++) % cnt]).fadeTo("slow",1.0);
			$('#caption').text(captions[(captions.length++) % cnt]);
			$('#caption').attr('href',urls[(urls.length++) % cnt]);
			
        });
}

