
function rotateBanner() {
    var $rotatingBanners = $("#rotating_banner li");	
    var $rotatingLink = $("#banner_more_info");
    var current = 0;
    var next = 1;
    var speed = 10000
    var transitionSpeed = 3000;
    var $rotatingBannerThumbs = $("#rotating_banner_thum li");
    var thumbTransparency = 0.3;
    $("#rotating_banner_thum li:not(:first)").fadeTo("700", thumbTransparency);
    var rotatingInterval = setInterval(cycleRotate, speed);
    function cycleRotate() {
        $($rotatingBannerThumbs[current]).fadeTo(transitionSpeed, thumbTransparency);
        $($rotatingBannerThumbs[next]).fadeTo(transitionSpeed, 1);
        $($rotatingBanners[current]).fadeOut(transitionSpeed);
        $($rotatingBanners[next]).fadeIn(transitionSpeed, function() {
            current = current + 1;
            if ( current > $rotatingBanners.length - 1 ) {
                current = 0;
            } else {    
            }
            next = next + 1;
            if ( next > $rotatingBanners.length - 1 ) {
                next = 0;
            }
            var link = $($rotatingBanners[current]).find("a").attr("href");
            $rotatingLink.attr("href", link);
        });
    }
    $rotatingBannerThumbs.mouseover(function() {
        clearInterval(rotatingInterval);
        var thisElem = $(this);
        $("#rotating_banner_thum li:not(this)").stop().animate({
            opacity: 0.3
        });
        thisElem.stop().animate({
            opacity: 1
        });
        var slideIndex =  thisElem.attr("rel");
        if ( slideIndex != current ) {
            $($rotatingBanners[current]).stop().animate({ opacity: 0 }, function() {
                $(this).hide();
            });
            $($rotatingBanners[slideIndex]).stop().css({ display: "block", opacity: 0 }).animate({ opacity: 1 });
            var link = $($rotatingBanners[slideIndex]).find("a").attr("href");
            $rotatingLink.attr("href", link);
        }
        current = slideIndex;
    });
}
    