function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}
function ChangeOpacity(id,msDuration,msStart,fromO,toO)
{
  var element=document.getElementById(id);
  var opacity = element.style.opacity * 100;
  var msNow = (new Date()).getTime();
  opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
  if (opacity<0) 
    SetOpacity(element,0)
  else if (opacity>100)
    SetOpacity(element,100)
  else
  {
    SetOpacity(element,opacity);
    element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",1);
  }
}
function FadeIn(id)
{
  var element=document.getElementById(id);
  SetOpacity(element,0);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",0,100)",1);
   element.style.visibility = 'visible';	
}

var images=new Array();
images[0]="http://www.newpointlearning.com/images/l2_bg.jpg";
images[1]="http://www.newpointlearning.com/images/l3_bg.jpg";
images[2]="http://www.newpointlearning.com/images/l4_bg.jpg";
images[3]="http://www.newpointlearning.com/images/l5_bg.jpg";
images[4]="http://www.newpointlearning.com/images/l6_bg.jpg";
images[5]="http://www.newpointlearning.com/images/l7_bg.jpg";
images[6]="http://www.newpointlearning.com/images/l8_bg.jpg";
images[7]="http://www.newpointlearning.com/images/l9_bg.jpg";


function randomimage() {
	
alert('random images');	

var i=Math.floor(Math.random()*images.length);


var header=document.getElementById('header2');
alert(header.style.backgroundImage);
//alert(i);
var countTestimonialsHolder=document.getElementById('countTestimonials');
if (countTestimonialsHolder) 
    var countTestimonials = countTestimonialsHolder.value;

var thisTestimonialString='testimonials'+iTestimonials;
var thisTestimonial=document.getElementById(thisTestimonialString);
if (thisTestimonial)
    thisTestimonial.style.display="none";
	
if (iTestimonials==countTestimonials) iTestimonials=1;
else iTestimonials++;

var nextTestimonialString='testimonials'+iTestimonials;
var nextTestimonial=document.getElementById(nextTestimonialString);
alert (nextTestimonial);
if (nextTestimonial)
    nextTestimonial.style.display="block";
	
if (header){

   alert('header');
   
   thisAd1++;
   if (thisAd1 == imgCt1) {
	   thisAd1 = 0
   }
 //  alert (images[thisAd1]);
   header.style.backgroundImage = 'url(' + images[i] + ')';
 //  header.style.backgroundImage = 'url(' + images[i] + ')';
   FadeIn('header2');
   setTimeout("randomimage()", 3 * 2400)
}

}
onload=randomimage;

