﻿/// <reference path="jquery-1.3.2.js" />

$(document).ready(function() {
    
    contentRotator($("ul#banner > li:first"));
});

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"));
                        }, 10000);
                    }
                    else { /* FADE IN NEXT ITEM  */
                        setTimeout(function() {
                            contentRotator($(content.next()));
                        }, 10000);
                    }
                });
            };
        } (content));
    }
}

