
/* Script taken from http://www.leemessenger.co.uk - Please do not remove this line */
function ChangeCSSBgImg() {
	if (!document.getElementById) return false;
	
	var MyElement = "picbox" //The ID of the element you want to change
	var ImgPath = "img/bgphotos/" //The file path to your images
	
	if (!document.getElementById(MyElement)) return false;
	
	var random_images = new Array ();
	random_images[0] = "pic_01.jpg"; // Don't forget to increase the array number each time
	random_images[1] = "pic_02.jpg"; // Don't forget to increase the array number each time
	random_images[2] = "pic_03.jpg"; // Don't forget to increase the array number each time
	random_images[3] = "pic_04.jpg"; // Don't forget to increase the array number each time
	random_images[4] = "pic_05.jpg"; // Don't forget to increase the array number each time
	random_images[5] = "pic_06.jpg"; // Don't forget to increase the array number each time
	random_images[6] = "pic_07.jpg"; // Don't forget to increase the array number each time
	random_images[7] = "pic_08.jpg"; // Don't forget to increase the array number each time
	random_images[8] = "pic_09.jpg"; // Don't forget to increase the array number each time
	random_images[9] = "pic_10.jpg"; // Don't forget to increase the array number each time
	random_images[10] = "pic_11.jpg"; // Don't forget to increase the array number each time
	random_images[11] = "pic_12.jpg"; // Don't forget to increase the array number each time
	random_images[12] = "pic_13.jpg"; // Don't forget to increase the array number each time
	random_images[13] = "pic_14.jpg"; // Don't forget to increase the array number each time
	random_images[14] = "pic_15.jpg"; // Don't forget to increase the array number each time
	random_images[15] = "pic_16.jpg"; // Don't forget to increase the array number each time
	random_images[16] = "pic_17.jpg"; // Don't forget to increase the array number each time
	
	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()",30000);
}

/* 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);
