﻿
        jQuery.easing['MR_swing'] = function(x, t, b, c, d) {
            if (t < d / 2) return 2 * c * t * t / (d * d) + b;
            var ts = t - d / 2;
            return -2 * c * ts * ts / (d * d) + 2 * c * ts / d + c / 2 + b;
        }
        jQuery(document).ready(function() {
            jQuery('#mycarousel').jcarousel({
                easing: 'MR_swing',
                animation: 1000,
                scroll: 1,
                auto: 3,
                wrap: 'circular'

            });

            jQuery('#MyText').jcarousel({
                easing: 'MR_swing',
                animation: 1800,
                scroll: 1,
                auto: 3,
                wrap: 'circular'

            });


        });

        function slideSwitch() {
            var $active = $('#slideshow IMG.active');

            if ($active.length == 0) $active = $('#slideshow IMG:last');

            // use this to pull the images in the order they appear in the markup
            var $next = $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

            // uncomment the 3 lines below to pull the images in random order

            // var $sibs  = $active.siblings();
            // var rndNum = Math.floor(Math.random() * $sibs.length );
            // var $next  = $( $sibs[ rndNum ] );


            $active.addClass('last-active');

            $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function() {
            $active.removeClass('active last-active');
        });
        }


        function slideSwitchText() {
            var $active1 = $('#slideshowText li.active');

            if ($active1.length == 0) $active1 = $('#slideshowText li:last');

            // use this to pull the images in the order they appear in the markup
            var $next = $active1.next().length ? $active1.next()
        : $('#slideshowText li:first');

            // uncomment the 3 lines below to pull the images in random order

            // var $sibs  = $active.siblings();
            // var rndNum = Math.floor(Math.random() * $sibs.length );
            // var $next  = $( $sibs[ rndNum ] );


            $active1.addClass('last-active');

            $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function() {
            $active1.removeClass('active');
            $active1.removeAttr("style");
        });
        }
        $(function() {
            setInterval("slideSwitch()", 5000);
            setInterval("slideSwitchText()", 5000);
        });

