// JavaScript Document

function mm_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=mm_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}



// The number of milliseconds to wait before switching images
var iDisplay = 3000

// SCRIPT
var oTimer = null
var iCurrent = 0
var sSource = ""
var sHref = ""

/*Transition effects:
0	Box in.
1	Box out.
2	Circle in.
3	Circle out.
4	Wipe up.
5	Wipe down.
6	Wipe right.
7	Wipe left.
8	Vertical blinds.
9	Horizontal blinds.
10	Checkerboard across.
11	Checkerboard down.
12	Random dissolve.
13	Split vertical in.
14	Split vertical out.
15	Split horizontal in.
16	Split horizontal out.
17	Strips left down.
18	Strips left up.
19	Strips right down.
20	Strips right up.
21	Random bars horizontal.
22	Random bars vertical.
23	Random transition from above possible values.*/

var sTransition = 12

/*function doDisplay() {
  // Try and display the image
  clearTimeout(oTimer)
  // The sSource is only set when the image is already available
  if (sSource!="") {
    // Use IE Transition
    if (document.images.slideShow.filters) { 
      document.images.slideShow.filters[0].Stop()
      document.images.slideShow.filters[0].Apply()
      // Use a random transition effect
      document.images.slideShow.filters.revealTrans.transition=sTransition
    }
    document.images.slideShow.src = sSource
	document.getElementById("slideShowLink").href = sHref
	status = "doDisplay > " + document.getElementById("slideShowLink").href + " / " + sHref + "/" + iCurrent;
    
    // Run the transition in IE
    if (document.images.slideShow.filters)
      document.images.slideShow.filters[0].Play()
  }
}

function doReadyImage() {
  // Image is ready for display
  sSource = this.src
  // If time period expired just display
  if (oTimer==null) doDisplay()
}

function doErrorDisplay() {
  // If error, get next image
  // NOTE - Script not well written if all images fail
  clearTimeout(oTimer)
  doLoad()
}

function doLoad() {
  // Start getting the next image
  clearTimeout(oTimer)
  var img = new Image()
  img.onload = doReadyImage
  img.onerror = doErrorDisplay 
  sSource = ""
  iCurrent++
  if (iCurrent==aImages.length) iCurrent=0
  oTimer = setTimeout("oTimer=null;doDisplay()",iDisplay)
  img.src = aImages[iCurrent][0]
  sHref = aImages[iCurrent][1]
  //status = "doLoad > " + sSource + " / " + sHref;
}

function quickNextLoad() {
  // Get next image ASAP
  clearTimeout(oTimer)
  oTimer=null
  var img = new Image()
  img.onload = doReadyImage
  img.onerror = doErrorDisplay
  img.src = aImages[iCurrent][0]
}

function quickPrevLoad() {
  // Get previous image ASAP
  clearTimeout(oTimer)
  oTimer=null
  var img = new Image()
  img.onload = doReadyImage
  img.onerror = doErrorDisplay 
  iCurrent-=1
  if (iCurrent<0) iCurrent=aImages.length-1
  iCurrent-=1
  if (iCurrent<0) iCurrent=aImages.length-1
  img.src = aImages[iCurrent][0]
}*/

function doDisplay() {
	sSource = aImages[iCurrent][0]
	sHref = aImages[iCurrent][1]
	if (sSource!="") {
		// Use IE Transition
		if (document.images.slideShow.filters) { 
			document.images.slideShow.filters[0].Stop()
			document.images.slideShow.filters[0].Apply()
			document.images.slideShow.filters.revealTrans.transition=sTransition
		}
		document.images.slideShow.src = sSource
		document.getElementById("slideShowLink").href = sHref
		
		// Run the transition in IE
		if (document.images.slideShow.filters)
			document.images.slideShow.filters[0].Play()
	}
}

function doLoad() {
  // Start getting the next image
  clearTimeout(oTimer)
  iCurrent++
  if (iCurrent==aImages.length) iCurrent=0
  oTimer = setTimeout("oTimer=null;doDisplay()",iDisplay)
}

function quickNextLoad() {
  //iCurrent++
  //if (iCurrent==aImages.length) iCurrent=0
  doDisplay()
}

function quickPrevLoad() {
  iCurrent--
  if (iCurrent<0) iCurrent=aImages.length-1
  iCurrent--
  if (iCurrent<0) iCurrent=aImages.length-1
  doDisplay()
}

function initSlideShow(){
	if(aImages.length > 0){
		document.write('<a id="slideShowLink" href="' + aImages[0][1] + '" title="' + sTitle + '" rel="lightbox[foto]"><img name="slideShow" src="' + aImages[0][0] + '" onerror="doLoad()" onload="doLoad()" style="filter: revealTrans(transition=' + sTransition + ')" /></a>');
		if(aImages.length > 1) document.write('<div id="slide"><p id="vorige"><a href="#" onclick="quickPrevLoad();return false">prev</a></p><p id="volgende"><a href="#" onclick="quickNextLoad();return false">next</a></p></div>');
		//doLoad();
	}
}