var huidig;

function titel(fotonr){
	var tekst = eval("foto"+fotonr+"[0];");
	document.getElementById("titel").innerHTML=tekst;
}

function zetterug(){
	var tekst = eval("foto"+huidig+"[0];");
	document.getElementById("titel").innerHTML=tekst;
}

function veranderfoto(fotonr){
	huidig = fotonr;
	var fotourl;
	fotourl = eval("foto"+fotonr+"[1];")
	document.images["foto"].src = fotourl;
}

function terug(){
	if(huidig!=1){
		titel(huidig-1);
		veranderfoto(huidig-1);		
	}
}

function terughover(){
	if(huidig!=1){
		var vorige = huidig-1;
		var tekst = eval("foto"+vorige+"[0];");	
		document.getElementById("titel").innerHTML=tekst;
	}
}

function verder(){
	if(huidig!=aantal){
		titel(huidig+1);
		veranderfoto(huidig+1);		
	}
}

function verderhover(){
	if(huidig!=aantal){
		var volgende = huidig+1;
		var tekst = eval("foto"+volgende+"[0];");	
		document.getElementById("titel").innerHTML=tekst;
	}
}

function laden(){
	for(var i=1;i<=aantal;i++){
		eval("Preload(foto"+i+"[1]);");
	}
	veranderfoto(1);
	titel(1);	
}
 
function Preload(){ 
  var args = Preload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++){
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}
