var quoteContainerId;
var quoteContainer;
var quotes;
var quoteRotationDelay;
var currQuoteIndex;

var imageId;
var image;
var images;
var imageRotationDelay;
var currImageIndex;


function startQuoteRotation(){
 quoteContainer = document.getElementById(quoteContainerId); 
 currQuoteIndex = -1;//set less than 0 to trigger random sort
 rotateQuotes();
}

function rotateQuotes(){
  if(quoteContainer){

    if(quotes){

      if(currQuoteIndex < 0 || currQuoteIndex >= quotes.length){
         currQuoteIndex = 0;
	 quotes.sort(randOrd);//re-sort
      }

      quoteContainer.innerHTML = quotes[currQuoteIndex];

      currQuoteIndex++;

    }    


    setTimeout("rotateQuotes()", quoteRotationDelay);
	
  }

};


function startImageRotation(){
 image = document.getElementById(imageId); 
 currImageIndex = -1;//set less than 0 to trigger random sort
 rotateImages();
}

function rotateImages(){
  if(image){

    if(images){

      if(currImageIndex < 0 || currImageIndex >= images.length){
         currImageIndex = 0;
	 images.sort(randOrd);//re-sort
      }

      image.src = images[currImageIndex];

      currImageIndex++;

    }    


    setTimeout("rotateImages()", imageRotationDelay);
	
  }

};


function randOrd(){
  return (Math.round(Math.random())-0.5);
}

