/*** 
 * Simple jQuery Slideshow Script
 * Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
 ***/
function slideSwitch(slideshowId, direction) {
    
    
    var $active = $('#'+slideshowId+' IMG.active');
    if ( $active.length == 0 ) $active = $('#'+slideshowId+' IMG:last');

    // use this to pull the images in the order they appear in the markup
    if(direction == "right") {
	    var $next =  $active.next().length ? $active.next()
	        : $('#'+slideshowId+' IMG:first');
    }

    if(direction == "left") {
    	var $next =  $active.prev().length ? $active.prev()
	        : $('#'+slideshowId+' IMG:last');
    }

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function() {
	$("#slide-right").click(function() {
		slideSwitch("serviceSlideshow", "right");
		return false;
	});
	$("#slide-left").click(function() {
		slideSwitch("serviceSlideshow", "left");
		return false;
	});
    setInterval( "slideSwitch('pressSlideshow', 'right')", 4000 );
    setInterval( "slideSwitch('serviceSlideshow', 'right')", 5000 );
});