var totalSlides;
var current = 1;
var pixels = 0;
var slideshow;

function nextSlide(stop) {
    if(stop == "stop") clearInterval(slideshow);
    //Figure out where it needs to animate to.
    current++;
    if(current > totalSlides) {
        current = 1;
    }
    pixels = (current-1) * 1000;
    
    //Animate to the next slide.
    $('#slideshow').animate({ marginLeft : -pixels }, 450, 'swing');
}


$(document).ready(function() {
    $('ul.sf-menu').supersubs({ 
            minWidth:    5,   // minimum width of sub-menus in em units 
            maxWidth:    20,   // 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({ 
            delay:       100,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},
            dropShadows: false                            // disable drop shadows 
    });
    
    totalSlides = $(".showcaseSlide").length;
    slideshow = setInterval( nextSlide, 5500);
});
