//Billboard Rotation
function BillboardRotation() {
	if (!document.getElementById) return false;
	
	if (!document.getElementById("Billboard")) return false;
	
	var random_images = new Array ();
	random_images[0] = "1.jpg";
	random_images[1] = "2.jpg";
	random_images[2] = "3.jpg";
	random_images[3] = "4.jpg";
	random_images[4] = "5.jpg";
	random_images[5] = "6.jpg";
	
	var DefaultBackground = document.getElementById("Billboard").style.backgroundImage;
	var ImageURL = "url(" + "/Images/Design/Screen/Billboards/" + random_images[rand(random_images.length)] + ")";
	
	if (DefaultBackground != ImageURL) {
		document.getElementById("Billboard").style.backgroundImage = ImageURL;	
	}	
//	if (ImageURL == "url(" + "/Images/Design/Screen/Billboards/1.jpg" + ")") {
//		document.getElementById("Testimonial-01").style.display = "block";	
//		document.getElementById("Testimonial-02").style.display = "none";	
//		document.getElementById("Testimonial-03").style.display = "none";	
//	}
//	if (ImageURL == "url(" + "/Images/Design/Screen/Billboards/2.jpg" + ")") {
//		document.getElementById("Testimonial-02").style.display = "block";		
//		document.getElementById("Testimonial-01").style.display = "none";	
//		document.getElementById("Testimonial-03").style.display = "none";	
//	}
//	if (ImageURL == "url(" + "/Images/Design/Screen/Billboards/3.jpg" + ")") {
//		document.getElementById("Testimonial-03").style.display = "block";	
//		document.getElementById("Testimonial-01").style.display = "none";	
//		document.getElementById("Testimonial-02").style.display = "none";		
//	}
//	movement = setTimeout("BillboardRotation()",10000); 
}
function rand(n) {
  return ( Math.floor ( Math.random ( ) * n ) );
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } 
  	else {
    	window.onload = function() {
      	oldonload();
      	func();
    }
  }
}
addLoadEvent(BillboardRotation);

//var cDivCount = 7;        //Keep track of number of divs to rotate
//var cDivWidth = 320;      //Keep track of div width
//var cSeqEnd = 20;         //Keep track of number of steps in animation
//var cTimeToSwitch = 5000; //Keep track of milliseconds before switching to next div
//var cAnimateTime = 50;    //Keep track of milliseconds between steps in animation
//var cSlideIncrement = cDivWidth / cSeqEnd;
//var cFadeIncrement = 1 / cSeqEnd;
//
//var vDoSwitch = false;
//var vCurDiv = 1;
//var vSeq = 0;
//
//function TimeSwitch() {
//   vDoSwitch = true;                      //Tell program to proceed with switch
//   setTimeout(FadeDivOut, cTimeToSwitch);  //Activate switch after X seconds
//}
//function StopSwitch() {
//   vDoSwitch = false;     //Tell program to cancel switch
//}
//function SwitchDiv() {
//   if (vDoSwitch) {        //If switch is set to go, then choose switch type
//      if (document.getElementById('optSlide').checked)
//         SlideDivOut();    //#1 - Slide current div out, then slide new div in
//      else if (document.getElementById('optFade').checked)
//         FadeDivOut();     //#2 - Fade current div out, then fade new div in
//      else {               //#3 - No animation, just hide the current and show the new
//         document.getElementById('Testimonial' + vCurDiv).style.display = 'none';
//         AdvanceDiv();
//         document.getElementById('Testimonial' + vCurDiv).style.display = 'block';
//         TimeSwitch();    //Start timer to switch again in X seconds
//      }
//   }
//}
//function SlideDivOut() {
//   if (vSeq < cSeqEnd) {
//      vSeq++;
//      document.getElementById('Testimonial' + vCurDiv).style.left = (vSeq * cSlideIncrement) + 'px';
//      setTimeout(SlideDivOut, cAnimateTime);
//   }
//   else {
//      vSeq = 0;
//      document.getElementById('Testimonial' + vCurDiv).style.display = 'none';
//      document.getElementById('Testimonial' + vCurDiv).style.left = '0px';
//      document.getElementById('Testimonial' + vCurDiv).style.top = '0px';
//      AdvanceDiv();
//      document.getElementById('Testimonial' + vCurDiv).style.left = (cDivWidth * -1) + 'px';
//      document.getElementById('Testimonial' + vCurDiv).style.display = 'block';
//      setTimeout(SlideDivIn, cAnimateTime);
//   }
//}
//function SlideDivIn() {
//   if (vSeq < cSeqEnd) {
//      vSeq++;
//      document.getElementById('Testimonial' + vCurDiv).style.left = ((cDivWidth * -1) + (vSeq * cSlideIncrement)) + 'px';
//      setTimeout(SlideDivIn, cAnimateTime);
//   }
//   else {
//      vSeq = 0;
//      document.getElementById('Testimonial' + vCurDiv).style.left = '0px';  //Just in case animation was a tad off
//      TimeSwitch();    //Start timer to switch again in X seconds
//   }
//}
//function FadeDivOut() {
//   if (vSeq < cSeqEnd) {
//      vSeq++;
//      var vOpacity = 1 - (vSeq * cFadeIncrement);
//      document.getElementById('Testimonial' + vCurDiv).style.opacity = vOpacity;
//      document.getElementById('Testimonial' + vCurDiv).style.filter = 'alpha(opacity=' + (vOpacity * 100) + ')';
//      setTimeout(FadeDivOut, cAnimateTime);
//   }
//   else {
//      vSeq = 0;
//      document.getElementById('Testimonial' + vCurDiv).style.display = 'none';
//      document.getElementById('Testimonial' + vCurDiv).style.opacity = 1;
//      document.getElementById('Testimonial' + vCurDiv).style.filter = 'alpha(opacity=100)';
//      AdvanceDiv();
//      document.getElementById('Testimonial' + vCurDiv).style.opacity = 0;
//      document.getElementById('Testimonial' + vCurDiv).style.filter = 'alpha(opacity=0)';
//      document.getElementById('Testimonial' + vCurDiv).style.display = 'block';
//      setTimeout(FadeDivIn, cAnimateTime);
//   }
//}
//function FadeDivIn() {
//   if (vSeq < cSeqEnd) {
//      vSeq++;
//      var vOpacity = vSeq * cFadeIncrement;
//      document.getElementById('Testimonial' + vCurDiv).style.opacity = vOpacity;
//      document.getElementById('Testimonial' + vCurDiv).style.filter = 'alpha(opacity=' + (vOpacity * 100) + ')';
//      setTimeout(FadeDivIn, cAnimateTime);
//   }
//   else {
//      vSeq = 0;
//      document.getElementById('Testimonial' + vCurDiv).style.opacity = 1;  //Just in case animation was a tad off
//      document.getElementById('Testimonial' + vCurDiv).style.filter = 'alpha(opacity=100)';
//      TimeSwitch();    //Start timer to switch again in X seconds
//   }
//}
//function AdvanceDiv() {
//   if (vCurDiv == cDivCount)
//      vCurDiv = 1;
//   else
//      vCurDiv++;
//}
//addLoadEvent(TimeSwitch);
