// Set speed (milliseconds)
var speed = 6000

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = 'fileadmin/img/01.jpg'
Pic[1] = 'fileadmin/img/02.jpg'
Pic[2] = 'fileadmin/img/03.jpg'
Pic[3] = 'fileadmin/img/04.jpg'
Pic[4] = 'fileadmin/img/05.jpg'

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 1 //start from 2nd pic
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

var bodyMain = document.getElementById('main')

function runBGSlideShow(){
   if (bodyMain){
   	//alert(j);
   bodyMain.style.backgroundImage = "url(" + Pic[j] + ")";
   j = j + 1
   if (j > (p-1)) j=0
   }
}

$(function() {
    setInterval( "runBGSlideShow()", speed );
});

