// JavaScript Document
var displayTime, bannerIndex, bannerLocations, hex, elementID;

function initVar() 
{
	hex1=44;
	hex2=66;
	hex3=130; // Initial color value.
	displayTime = 3;
	elementID = "comment";
	bannerLocations = new Array("<b>Look at what folks have to say about us!</b>",
								"\"Everyone was really nice and I loved<br>the individual dog rooms instead of cages\"",
						"\"Very impressed with staff and facility\" ",
						"\"Beautiful shelter, all animals<br>seem healthy and happy\"",
						"\"Exceptional level of professionalism<br>and friendliness\"",
						"\"Great facility and staff – animals<br>are lucky to be here!\"",
						"\"I was very impressed by the cleanliness and overall care the animals are given..\" ",
						"\"Staff is great! Love the facilities…such a warm<br>and comforting environment for the animals\"",
						"\"Excellent shelter with super friendly staff<br>and great facility for animals\"",
						"\"Excellent help, friendly and informative,<br>especially for first time cat owners\"",
						"\"I called this morning, made an adoption appointment, and adopted the type of kitten<br>I was looking for – thank you!\"");
}

function setVals()
{
	//hex = 0
	document.getElementById(elementID).style.color="rgb("+hex1+","+hex2+","+hex3+")";
	bannerIndex = (bannerIndex < (bannerLocations.length - 1)) ? ++bannerIndex :0; 
	document.getElementById(elementID).innerHTML =  bannerLocations[bannerIndex];
	
	setTimeout("fadetext()", displayTime * 1000);	
}

function fadetext(){ 
	
  if(hex1<255 || hex2<255 || hex3<255) { //If color is not black yet
  	if(hex1<255) hex1+=11;
	if(hex2<255) hex2+=11;
	if(hex3<255) hex3+=11
    //hex+=11; // increase color darkness
    document.getElementById(elementID).style.color=
                      "rgb("+hex1+","+hex2+","+hex3+")";
    setTimeout("fadetext()",100);
	
  }
  else{
  	pausecomp(1500)
	hex1=44;
	hex2=66;
	hex3=130;
    //hex=0 //reset hex value
	setVals()	
  }
}

function pausecomp(millis) 
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); } 
	while(curDate-date < millis);
} 


