  var externalFile = "./get_quotes.php";
  var index = Math.floor(Math.random()*2);  
  var quotes = false;
  var quotesObject = false;

  function saveContent() {
    var content = quotesObject.response;
    quotes = content.split('|');	
	
	rotate();
  }	  

  function buildQuote() { 
   	var quote_info = quotes[index].split('###');

	if (quote_info[1].toLowerCase() == "testimonial") {
		document.getElementById('testimonial_top').style.backgroundImage = "url(/imgs/testimonial_top.png)";
		//alert("Testimonial - " + document.getElementById("testimonial_top").style.backgroundImage);
	}
	else {
		document.getElementById('testimonial_top').style.backgroundImage = "url(/imgs/news_flash_top.png)";	
		//alert("News flash - " + document.getElementById("testimonial_top").style.backgroundImage);
	}

	//document.getElementById('quote_type').innerHTML = quote_info[1];
	document.getElementById('quote_author').innerHTML = quote_info[2];	
	document.getElementById('quote_text').innerHTML = quote_info[3];	
  }

  quotesObject = new sack();  
  quotesObject.requestFile = externalFile;	// Specifying which file to get  
  quotesObject.onCompletion = function() { saveContent(); };	// Specify function that will be executed after file has been found
  quotesObject.runAJAX(); 
   
  function rotate() {
    buildQuote();
	
    window.setTimeout("rotate()",10000); // 5 sec
	if (index == quotes.length - 1) index = 0;
    else index++;
  }  

