/**
 * Spotlight Class
 * Rotates through spotlights. Can be started and stopped.
 */
function Spotlight() {
    var _interval = false;

    this.start = function() {
        setTimeout(this.rotate, 500);
        if (_interval) {
            return;
        }
        _interval = setInterval(this.rotate, 15000);
    }

    this.stop = function() {
        if (_interval) {
            clearInterval(_interval);
            _interval = false;
            $j("#spotlight").html('&nbsp;');
        }
    }

    this.rotate = function() {
        $j("#spotlight").fadeOut(250, function() {
            $j.get("Spotlight.php?spotlight=true",{}, function(response) {
                $j("#spotlight").html(response).hide(100, function() { 
                    $j("#spotlight").fadeIn(250) 
                })
            })
        });
    }
    
}

spotlight = new Spotlight();
