data = [
["/images/referenties/aarts.jpg", "Aarts toiletkabineverhuur", "/images/referenties/aarts.jpg"],
["/images/referenties/amsterdam.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/citycamps.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/feyenoord.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/heineken.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/kapellen.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/kpn.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/lipton.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/nijntje-1.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/nijntje-2.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/psv-1.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/remcoh.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/robeco.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/upc.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/voetbal.jpg", "Alt / Title text for image 1", "pic01.jpg"],
["/images/referenties/x-factor.jpg", "Alt / Title text for image 1", "pic01.jpg"]
]

imgPlaces = 6 // number of images visible
imgWidth = 100 // width of the images
imgHeight = 100 // height of the images
imgSpacer = 1 // space between the images

dir = 2 // 0 = left, 1 = right, 2 = down

newWindow = 1 // 0 = Open a new window for links 0 = no  1 = yes

// ********** End User Defining Area **********

moz = document.getElementById && !document.all

step = 1
timer = ""
speed = 50
nextPic = 0
initPos = new Array()
nowDivPos = new Array()

function initHIS3() {
    // Controleer of de div aanwezig is. Zo niet, dan meteen functie verlaten
    if(!document.getElementById("his3container"))
        return;

    var i;
    for (i = 0; i < imgPlaces + 1; i++) { // create image holders
        var newImg = new Image()
        newImg.id = "pic_" + i
        newImg.src = ""
        newImg.style.position = "absolute"
        newImg.style.width = imgWidth + "px"
        newImg.style.height = imgHeight + "px"
        newImg.style.border = 0
        newImg.alt = ""
        newImg.i = i
        newImg.onclick = function () { his3Win(data[this.i][2]) }
        document.getElementById("display_area").appendChild(newImg)
    }

    containerEL = document.getElementById("his3container")
    displayArea = document.getElementById("display_area")
    pic0 = document.getElementById("pic_0")

    containerBorder = (document.compatMode == "CSS1Compat" ? 0 : parseInt(containerEL.style.borderWidth) * 2)

    if (dir > 1) {
        containerHeight = (imgPlaces * imgHeight) + ((imgPlaces - 1) * imgSpacer)
        displayArea.style.height = containerHeight + "px"
        displayArea.style.clip = "rect(0," + (imgWidth + "px") + "," + (containerHeight + "px") + ",0)"
        containerEL.style.width = imgWidth + (!moz ? containerBorder : "") + "px"
        containerEL.style.height = containerHeight + (!moz ? containerBorder : "") + "px"
        imgPos = -imgHeight
    } else {
        containerWidth = (imgPlaces * imgWidth) + ((imgPlaces - 1) * imgSpacer)
        displayArea.style.width = containerWidth + "px"
        displayArea.style.clip = "rect(0," + (containerWidth + "px") + "," + (imgHeight + "px") + ",0)"
        containerEL.style.width = containerWidth + (!moz ? containerBorder : "") + "px"
        containerEL.style.height = imgHeight + (!moz ? containerBorder : "") + "px"
        imgPos = -pic0.width
    }

    displayArea.onmouseover = function () { stopHIS3() }
    displayArea.onmouseout = function () { scrollHIS3() }

    for (i = 0; i < imgPlaces + 1; i++) {
        currentImage = document.getElementById("pic_" + i)
        switch (dir) {
            case 0: // naar links
                imgPos += pic0.width + imgSpacer
                initPos[i] = imgPos
                currentImage.style.left = initPos[i] + "px"
                break;
            case 1: // naar rechts
                imgPos += pic0.width + imgSpacer
                initPos[i] = imgPos
                currentImage.style.left = initPos[i] + "px"
                break;
            case 2: // boven naar beneden
                imgPos += imgHeight + imgSpacer
                initPos[i] = imgPos
                currentImage.style.top = initPos[i] + "px"
                break;
            case 3: // beneden naar boven
                imgPos += pic0.height + imgSpacer
                initPos[i] = imgPos
                currentImage.style.top = initPos[i] + "px"
                break;
        }

        if (nextPic == data.length) {
            nextPic = 0
        }

        currentImage.src = data[nextPic][0]
        currentImage.alt = data[nextPic][1]
        currentImage.i = nextPic
        currentImage.onclick = function () { his3Win(data[this.i][2]) }
        nextPic++
    }

    scrollHIS3()
}

function scrollHIS3() {
    var switchPict = 0
    clearTimeout(timer)
    for (var i = 0; i < imgPlaces + 1; i++) {
        currentImage = document.getElementById("pic_" + i)

        switch (dir) {
            case 0:
                nowDivPos[i] = parseInt(currentImage.style.left)
                nowDivPos[i] -= step
                break;
            case 1:
                nowDivPos[i] = parseInt(currentImage.style.left)
                nowDivPos[i] += step
                break;
            case 2:
                nowDivPos[i] = parseInt(currentImage.style.top)
                nowDivPos[i] += step
                break;
            case 3:
                nowDivPos[i] = parseInt(currentImage.style.top)
                nowDivPos[i] -= step
                break;
        }

        if(dir == 0 ) {
            if(nowDivPos[i] <= -(pic0.width + imgSpacer))
                currentImage.style.left = containerWidth + imgSpacer + "px"
            else
                currentImage.style.left = nowDivPos[i]+"px"
        }

        if(dir == 1) {
            if(nowDivPos[i] > containerWidth)
                currentImage.style.left = -pic0.width - (imgSpacer * 2 ) + "px"
            else
                currentImage.style.left = nowDivPos[i]+"px"
        }

        if (dir == 2) {
            if (nowDivPos[i] > containerHeight) {
	       switchPict = 1
                currentImage.style.top = -(imgHeight - imgSpacer) + "px"
            } else
                currentImage.style.top = nowDivPos[i] + "px"
        }

        if (dir == 3) {
            if (nowDivPos[i] <= -(pic0.height + imgSpacer))
                currentImage.style.top = containerHeight + imgSpacer + "px"
            else
                currentImage.style.top = nowDivPos[i] + "px"
        }


        if (nextPic > data.length - 1)
            nextPic = 0

        if (switchPict > 0) {
            currentImage.src = data[nextPic][0]
            currentImage.alt = data[nextPic][1]
            currentImage.i = nextPic
            currentImage.onclick = function () { his3Win(data[this.i][2]) }
            switchPict = 0
        }

        nextPic++
    }
    timer = setTimeout("scrollHIS3()", speed)
}

function stopHIS3() {
    clearTimeout(timer)
}

function his3Win(loc) {
    if (loc == "") { return }
    if (newWindow == 0) {
        location = loc
    } else {
        //window.open(loc)
        newin = window.open(loc, 'win1', 'left=430,top=340,width=300,height=300') // use for specific size and positioned window
        newin.focus()
    }
}

// add onload="initHIS3()" to the opening BODY tag

// -->

