$.noConflict();

function slideSwitch() {
    var $active = jQuery('#slideshow-animate DIV.active');

    if ( $active.length == 0 ) $active = jQuery('#slideshow-animate DIV:last');
    var $next =  $active.next().length ? $active.next()
        : jQuery('#slideshow-animate DIV:first');
    $active.addClass('last-active');
    
    $next.children('span').show();
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.children('span').hide();
            $active.removeClass('active last-active');
        });
}

jQuery(function() {
    playSlideshow = setInterval( "slideSwitch()", 5000 );
    
    jQuery("#next-slide").click(function() {  
      var $currentslide = jQuery('#slideshow-animate div.active');
      if ( $currentslide.length == 0 ) $currentslide = jQuery('#slideshow-animate DIV:last');
       $currentslide.addClass('last-active');
      
      var $next =  $currentslide.next().length ? $currentslide.next(): jQuery('#slideshow-animate DIV:first');

     $next.children('span').show();  
     $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
	        $currentslide.removeClass('active last-active');
        }); 
    jQuery("#pause-slide").hide();
    jQuery("#play-slide").show();
    clearInterval(playSlideshow);
    return false; 
});

    jQuery("#prev-slide").click(function() {
      var $currentslide = jQuery('#slideshow-animate div.active');
      if ( $currentslide.length == 0 ) $currentslide = jQuery('#slideshow-animate DIV:first');
       $currentslide.addClass('last-active');
       
      var $prev =  $currentslide.prev().length ? $currentslide.prev() : jQuery('#slideshow-animate DIV:last');

     $prev.children('span').show();
	   $prev.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
	        $currentslide.removeClass('active last-active');
        });
        jQuery("#pause-slide").hide();
        jQuery("#play-slide").show();
        clearInterval(playSlideshow);
        return false;
});

    jQuery("#pause-slide").click(function() {
        jQuery("#play-slide").show();
        jQuery(this).hide();
        clearInterval(playSlideshow);
        return false;
});

    jQuery("#play-slide").click(function() {
        jQuery("#pause-slide").show();
        jQuery(this).hide();
        playSlideshow = setInterval( "slideSwitch()", 5000 );
        return false;
});   

}); 


