$(document).ready( function() {
    var textArray = [
        '"I have lived all over the country, and I\'ve never experienced a safer or friendlier environment. There is a large variety of activities, nearby shopping centers, medical centers and a management company that cares."  - Marv Rosenhaft, 4-year resident',
		'"Repairs are done in a timely manner and they listen to you. I would recommend the Village to anyone\; it\'s a great place to live."  - Marv Rosenhaft, 4-year resident',
		 '"We moved here in 1999 and have had a great time ever since, what with the over 200 clubs you can belong to, like Yachting, lawn bowling, bocce, jewelry, dancing and socializing among the other clubs that I love to participate in. My next club will be water color and oil painting; I love it to say the least. Stay active, be healthy and be happy."  - Conrad Hassoldt, 13-year resident',
		'"Repairs are done in a timely manner and they listen to you. I would recommend the Village to anyone\; it\'s a great place to live."  - Marv Rosenhaft, 4-year resident',
        '"Living in The Village provides opportunities for all - outgoing, shy, sporty, thinkers, gymnasts, actors - just everyone - to find their favorite things to do with like-minded seniors." - Ruth May, 14-year resident', 
		'"Our new, state-of-the-art golf building is phenomenal. I should know; I golf at least five days a week!" - Mike Moore, 11-year resident',
		'"I have lived here in the Village almost 20 years, and I could not find a better place in the World to spend my Golden years, there are just so many things to do, I am busy from morning till night doing fruitful and pleasing activities. Thank goodness for this wonderful Village in Paradise" - Sheila Bialka, 20-year resident ',
        '"We\'ve made tons of new friends by simply joining a few of the over 200 clubs here in the Village.  We\'ve met many villagers who have truly amazing backgrounds and life stories."  - Patty and Doug Rook, 6-year residents',
		'"Every time I come through my gate I am reminded how beautiful our Village is and how happy I am to live where I am free to occupy my time with a myriad of activities with friends and neighbors who have become dear to me over the years." Pat Feeney, 12 year resident',
		'"Since moving here in 2008, we have become hooked on the wonderful sport of lawn bowling. Because our community is so well taken care of, we can spend our time being outdoors and having fun." - Sandy and Wayne Helmer, 4-year residents',
           '"Interacting with other residents that have interests similar to yours is almost like reuniting with your old best friends from high school and college. We\'ve met many villagers who have truly amazing backgrounds and life stories."  - Patty and Doug Rook, 6-year residents',

    ];
    $('#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;
}


