// News Ticker


var msgQ=new Array();
var entryLgth = 0;
var x=0;

$(function() {


var elemQuote=new Array();
var elemCite=new Array();

 $.get('/xml/quotes/', function(data) {
 	entryLgth = $(data).find('item').length;
	 $(data).find("quote").each(function() {
	 		elemQuote[elemQuote.length++]=$(this).text();
	 	});	 	
	 	$(data).find("cite").each(function() {
	 		elemCite[elemCite.length++]=$(this).text();
	 	});		 	 	
	 	for(var i=0; i<elemQuote.length; i++){
		strToAppend="<p>" + elemQuote[i] + "<br /><span class=cite> " + elemCite[i] + "</span><\/p>";
		msgQ[msgQ.length++]=strToAppend;		
	}
 	}); 	
});

function Visualize(){
	if(x==entryLgth){
		x=0;
	}
	$(".pullquote #quotemask").empty();	
	$(".pullquote #quotemask").append(msgQ[x]);
	x++;
	$(".pullquote").animate({opacity: 'show'}, 20000, "easeout", function(){ 
  		$(this).animate({opacity: 'hide' }, 10000,function(){Visualize()}) 
	});
}

$(window).bind("load", function() {
	setTimeout("Visualize()",2000);
});