/*
	jQuery for crossfading Quotes
*/
var $j = jQuery.noConflict();

$j(function(){
    var i = 0;
    var active = 0;
    var total = $j('.quote-body').size();
    if (total > 1){
    $j('.quote-body').each( function() {
        if (i != 0){
            $j(this).fadeOut(0, function() {
            });
        }
        i++;
    });
    $j(document).everyTime(3000, function() {
        var i = 0;
        $j('.quote-body').each( function() {
            if (i == active){
                $j(this).fadeOut(700, function() {
                    if(!$j.support.opacity){
                        $j(this).get(0).style.removeAttribute('filter');
                    }
		});
            }
            i++;
        });
		var newactive = Math.floor(Math.random()*total);
		while (newactive == active){
			var newactive = Math.floor(Math.random()*total);
		}
		active = newactive;
        i = 0;
        $j('.quote-body').each( function() {
            if (i == active){
                $j(this).fadeIn(700, function() {
                    if(!$j.support.opacity) {
			$j(this).get(0).style.removeAttribute('filter');
                    }
		});
            }
            i++;
        });
    }, 0);
    }
});
