/*
    jQuery based quote shuffler and rotator.
    Copyright 2009-2010 Hallway Studios Limited
    http://www.hallwaystudios.com
*/

var lQuoteID = -1;

function next_quote() {
    if(lQuoteID == (aQuotes.length -1)) {
        lQuoteID = -1;
    }
    lQuoteID += 1;
    //alert(lQuoteID + ' ' + aQuotes.length);
    set_quote(aQuotes[lQuoteID]);
    
}

function set_quote(oQuote) {
    jQuery('#quote-box').hide();
    jQuery('#quote-box-text').html(oQuote.Text);
    jQuery('#quote-box-from P').html('&ndash; ' + oQuote.From);
    jQuery('#quote-box').fadeIn('slow');
}

function start_rotator() {
    if(aQuotes.length > 1) {
        next_quote();
        jQuery(document).everyTime('4s','quote_rotator', function(){ next_quote(); } );
    } else {
        set_quote(aQuotes[0]);
    }
}
