/* Script taken from leemessenger.co.uk - Please do not remove this line */

function ChangeCSSBgImg(num) {
i = num;
$('#bg_image').hide();
if (!document.getElementById) return false;

var MyElement = "bg_image" //The ID of the element you want to change
var ImgPath = "./wp-content/themes/steckiw/images/head/" //The file path to your images

if (!document.getElementById(MyElement)) return false;

var random_images = new Array ();
random_images[0] = "map1.jpg";
random_images[1] = "map2.jpg";
random_images[2] = "map3.jpg";
random_images[3] = "map4.jpg";
random_images[4] = "map5.jpg";


var $header = document.getElementById(MyElement);
var $backgroundurl = $header.style.backgroundImage;

var ImgURL = "url(" + ImgPath + random_images[num] + ")";


if ($backgroundurl != ImgURL) {


$header.style.backgroundImage = ImgURL;
$('#bg_image').fadeIn(1000);
}
i++;
if (i == 5) {i = 0; }
movement = setTimeout("ChangeCSSBgImg(i)",8000);
	
}

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


var i = 0;
		addLoadEvent(ChangeCSSBgImg(i));


