
/* Script taken from http://www.leemessenger.co.uk - Please do not remove this line */
function ChangeCSSBgImg() {
	if (!document.getElementById) return false;
	
	var MyElement = "header" //The ID of the element you want to change
	var ImgPath = "/img/headers/" //The file path to your images
	
	if (!document.getElementById(MyElement)) return false;
	
	var random_images = new Array ();
	random_images[0] = "header-bg_00.jpg";
	random_images[1] = "header-bg_01.jpg";
	random_images[2] = "header-bg_02.jpg";
	random_images[3] = "header-bg_03.jpg";
	random_images[4] = "header-bg_04.jpg";
	random_images[5] = "header-bg_05.jpg";
	random_images[6] = "header-bg_06.jpg";
	random_images[7] = "header-bg_07.jpg";
	random_images[8] = "header-bg_08.jpg";
	random_images[9] = "header-bg_09.jpg";
	random_images[10] = "header-bg_10.jpg";
	
	var $header = document.getElementById(MyElement);
	var $backgroundurl = $header.style.backgroundImage;
	var ImgURL = "url(" + ImgPath + random_images[rand(random_images.length)] + ")";
	
	if ($backgroundurl != ImgURL) {
		$header.style.backgroundImage = ImgURL;	
	}

	//movement = setTimeout("ChangeCSSBgImg()",3000);
}

/* random number generator */
function rand(n) {
  return ( Math.floor ( Math.random ( ) * n ) );
}

/* Custom onload function */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
/* trigger onload */
addLoadEvent(ChangeCSSBgImg);
