function showFoto(oElm){
	if(!oElm.firstChild)oElm = oElm.nextSibling;
	var oTarg = document.getElementById('Foto_groot');
	oTarg.src = oElm.firstChild.src.replace(/\/thumb/,'');
	oTarg.style.display = 'inline';
	oElm.parentNode.style.display = 'none';
	var oCurrent = document.getElementById('Foto_current');
	oCurrent.firstChild.nodeValue = getFotoNr(oElm);
	oCurrent.oPhoto = oElm;
	document.getElementById('Foto_header').style.display = 'block';
}
function nextFoto(){
	var oCurrent = document.getElementById('Foto_current');
	if(oCurrent.oPhoto.nextSibling){
		showFoto(oCurrent.oPhoto.nextSibling);
	}


}
function prevFoto(){
	var oCurrent = document.getElementById('Foto_current');
	if(oCurrent.oPhoto.previousSibling){
		showFoto(oCurrent.oPhoto.previousSibling);
	}
}

function getFotoNr(oElm){
	var i = 0;
	while(oElm){
		oElm = oElm.previousSibling;
		i++;
	}
	return i;
}


function hideFoto(oElm){
	var oTarg = document.getElementById('Foto_overzicht');
	oTarg.style.display = 'block';
	oElm.firstChild.style.display = 'none';
	document.getElementById('Foto_header').style.display = 'none';

}


var _tInterval;
var _iEnd = 40;
var _iCurrent = 50;
var _iStep = 0;
var _oScroll;


function animateScroll(oElm, iNumber){
	_oScroll = oElm;

	if(_iCurrent < _iEnd){
		_oScroll.scrollLeft += (_iEnd-_iCurrent)*_iStep;
		clearInterval(_tInterval);
	}
	_iStep = iNumber / _iEnd;
	_iCurrent = 0;
	_tInterval = setInterval(doAnimate, 10);

}

function doAnimate(){

	_oScroll.scrollLeft += _iStep;

	_iCurrent++;

	if(_iCurrent >= _iEnd)
		clearInterval(_tInterval);

}

var _oCurrentAgendaItem = null;
function doSelectAgendaItem(sId){
	var oElm = document.getElementById(sId);
	if(_oCurrentAgendaItem)
		_oCurrentAgendaItem.style.display = 'none';
	oElm.style.display = 'block';
	_oCurrentAgendaItem = oElm;
}


window.onresize = window.onload = function(){
	var iHeight = 768;
	if(self.innerHeight) iHeight = self.innerHeight;
	else if(document.documentElement && document.documentElement.clientHeight) iHeight = document.documentElement.clientHeight;
	else if(document.body) iHeight = document.body.clientHeight;
	var oElm = document.getElementById('BackgroundHolder');
	if(iHeight < 600){
		oElm.style.top = 'auto';
		oElm.style.marginTop = 'auto';
	}else{
		oElm.style.top = '';
		oElm.style.marginTop = '';
	}
}
