$(document).ready( function() {
    var textArray = [
        '"Very pleased with your company. I\'ll be recommending you to others."  Jo Hodges, Milwaukie',
        '"Excellent - Explained everything well. Even made friends with my dog."  Ross Wine, King City',
        '"Thom was great! Professional and good about explaining the process."  David Bleyle, Beaverton',
        '"Great workmanship; competent and skilled".  Ken Moss, Gresham',
        '"We found all of your people to be professional, friendly and considerate."  Michael Lowe, Beaverton',
        '"The best! I am continuing to recommend you guys."  Carol Smith, Beaverton',
        '"I saw my neighbor using you guys and knew they only use good companies."  Patricia Treece, West Linn'
    ];
    $('#text-content').loadText( textArray, 10000 ); // ( array, interval )
});
// custom jquery plugin loadText()
$.fn.loadText = function( textArray, interval ) {
    return this.each( function() {
        var obj = $(this);
        obj.fadeOut( 'slow', function() {
            obj.empty().html( random_array( textArray ) );
            obj.fadeIn( 'slow' );
        });
        timeOut = setTimeout( function(){ obj.loadText( textArray, interval )}, interval );
        // reload random text (if not animated) -- entirely optional, can be removed, along with the reload link above (<a href="javascript:;" id="text-reload"><em>randomize</em></a>)
        $("#text-reload").click( function(){
            if( !obj.is(':animated') ) { clearTimeout( timeOut ); obj.loadText( textArray, interval );} // animation check prevents "too much recursion" error in jQuery
        });
    });
}
//public function
function random_array( aArray ) {
    var rand = Math.floor( Math.random() * aArray.length + aArray.length );
    var randArray = aArray[ rand - aArray.length ];
    return randArray;
}
