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() {

var i=Math.floor(Math.random()*images.length);


var header=document.getElementById('header2');
//alert(header.style.backgroundImage);
//alert(i);
header.style.backgroundImage = 'url(' + images[i] + ')';
//alert(header.style.backgroundImage);
FadeIn('header2');
//document.getElementById("random").src=images[i];

}
onload=randomimage;
