﻿/*http://weblogs.asp.net/jaredroberts/archive/2010/02/19/simple-jquery-content-rotator.aspx*/
var doAnimate = true;       
function contentRotator(content) {
    if (doAnimate) {
        content.fadeOut("fast", function(content) {
            return function() {
                /* HIDE ALL ITEMS */
                $("ul#banner > li").hide();      
                content.fadeIn(2500, function() {
                    /* GO BACK TO FIRST ITEM */
                    if ($(this).attr("id") == $("ul#banner > li:last").attr("id")) {
                        setTimeout(function() {
                            contentRotator($("ul#banner > li:first"));
                        }, 5000);
                    }
                    else { /* FADE IN NEXT ITEM  */
                        setTimeout(function() {
                        contentRotator($(content.next()));
                        }, 5000);
                    }
                });
            };
        } (content));
    }
}
