 var intId;

        function slideSwitch() {
            
            var $active = $('#slideshow .slide.active');

            if ($active.length == 0) $active = $('#slideshow .slide:last');

            var $next = $active.next().length ? $active.next()
                    : $('#slideshow .slide:first');
            $active.addClass('last-active');

            $next.css({ opacity: 0.0 })
                .addClass('active')
                .stop(false, true)
                .animate({ opacity: 1.0 }, 1000, function () {
                    $active.removeClass('active last-active');
            });
        }

        $(document).ready(function () {
            SetTimer();

            $('#nav-next').click(function () {
                clearInterval(intId);
                slideSwitch();
                SetTimer();
            });

            $('#nav-previous').click(function () {
                clearInterval(intId);
                var $active = $('#slideshow .slide.active');
                
                if ($active.length <= 0) $active = $('#slideshow .slide:first');

                var $prev = $active.prev().length ? $active.prev()
       	 	        : $('#slideshow .slide:last');
                $active.addClass('last-active');

                $prev.css({ opacity: 0.0 })
                    .stop(false, true)
        	        .addClass('active')                    
        	        .animate({ opacity: 1.0 }, 1000, function () {
        	            $active.removeClass('active last-active');
        	});
                SetTimer();
            });

            function SetTimer() {
                intId = setInterval("slideSwitch()", 7000);
            }
        });

