var currentdate = 0
var core = 0

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '

  }
}

image = new StringArray(6)
image[0] = 'http://www.cobykoorn.nl/images/teaser_img1.jpg'
image[1] = 'http://www.cobykoorn.nl/images/teaser_img2.jpg'
image[2] = 'http://www.cobykoorn.nl/images/teaser_img3.jpg'
image[3] = 'http://www.cobykoorn.nl/images/teaser_img4.jpg'
image[4] = 'http://www.cobykoorn.nl/images/teaser_img5.jpg'
image[5] = 'http://www.cobykoorn.nl/images/teaser_img6.jpg'

var ran = 60/image.length

function ranimage() {
  currentdate = new Date()
  core = currentdate.getSeconds()
  core = Math.floor(core/ran)
    return(image[core])
}

function swap(imgIndex) {
    document['imgMain'].src = ranimage()
  }