// Provides random testimonials based on the testimonials.html page
// Created 09.13.10 CPP
//
$(document).ready(function(){
    //$('#quote').load( './testimonials.html #quotes>p:eq(3)');
    var quote_count = 0;
    $page = $(location).attr("href").split('/').pop();
    if ($page == 'Graduate_School_Admissions_Tests_101.html') {
        $grad = true;
    } else {
        $grad = false;
    }
    $('#quote').load( 'testimonials.html #quotes', function() {
        $('#quotes').hide();
        if ($grad) {
            quote_count = $('#quotes p.grad').size();
        } else {
            quote_count = $('#quotes p').size();
        }
        showQuote();
    });

    function showQuote() {
        rn = Math.floor(Math.random() * quote_count);
        if ($grad) {
            $('#quote').load( 'testimonials.html #quotes>p.grad:eq(' + rn + ')', function () {
                $('#quote').fadeIn(2000);
            });
        } else {
            $('#quote').load( 'testimonials.html #quotes>p:eq(' + rn + ')', function () {
                $('#quote').fadeIn(2000);
            });
        }
    }

	setInterval(function(){
        $('#quote').filter(':visible').fadeOut(2000,function(){
            showQuote();
        });
	},10000);	
});	

