
function loadFrame (pFrameHtml)
{
	new Ajax.Updater('frame', './algemeen/pag/frame' + pFrameHtml + '.php', {method: 'get'});
}

function $(v) {
	return(document.getElementById(v));
}

function $S(v) {
	return($(v).style);
}

function agent(v) {
	return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0));
}

function isset(v) {
	return((typeof(v)=='undefined' || v.length==0)?false:true);
}

function XYwin(v) {
	var z=agent('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth);
	return(isset(v)?z[v]:z);
}

function imageTOG() {
	document.onclick=function(){
		$S('imageBG').display='none';
		$S('imageBOX').display='none';
		document.onclick=function(){}; 
	};
}

vFotoTeller = 0;
vPrefix = "";

function getVolgendeFoto()
{
	if (!$(vPrefix + "foto" + vFotoTeller))
	{
		vFotoTeller = 0;
	}
	
	if ($(vPrefix + "foto" + vFotoTeller).src)
	{
	  vVolgendeFoto = "toonFoto('" + $(vPrefix + "foto" + vFotoTeller).src + "', '" + $(vPrefix + "foto" + vFotoTeller).alt + "')";
  }
	else if ($(vPrefix + "foto" + vFotoTeller).innerHTML)
	{
		vSplit = $(vPrefix + "foto" + vFotoTeller).innerHTML.split(";");
		vVolgendeFoto = "toonFoto('" + vSplit [0] + "', '" + vSplit [1] + "')";
	}
	
	vFotoTeller ++;
	
	return vVolgendeFoto;
}

function imageBOX(v,b, pTekstveld) {
	if (pTekstveld != "")
	{
		pTekstveld += "<br/>";
	}
	
	if ($(vPrefix + "foto" + (vFotoTeller - 1)) && $(vPrefix + "foto" + (vFotoTeller - 1)).innerHTML)
	{
		breedteIn = $(vPrefix + "foto" + (vFotoTeller - 1)).innerHTML.split(";")[2];
		
		if (typeof breedteIn != "undefined")
		{
			b = breedteIn;
		}
	}
	
	if (b < 250)
	{
		b = 250;
	}
	
	setTimeout("imageTOG()",100);
	$S('imageBG').height=XYwin(0)+'px';
	$S('imageBG').display='block';
	$('imageBOX').innerHTML='<a href="#" onclick="' + getVolgendeFoto() + '">' + v + '</a><div class="imageX" id="imageX"><b>' + 
	pTekstveld + '</b>(op de foto klikken om de volgende te zien)<br/>(naast de foto klikken om te sluiten)' + "<\/div>";
	$S('imageBOX').left=Math.round((XYwin(1)-b)/2)+'px';
	$S('imageBOX').width=b+'px';
	$S('imageBOX').display='block';
}

function toonFoto (pFoto, pTekstveld, pFotoTeller, d, pPrefix)
{
	if (pFotoTeller > -1)
	{
	  vFotoTeller = ++ pFotoTeller;
  }
  
  if (pPrefix)
  {
     vPrefix = pPrefix;
  }
  
	vImage = new Image();
  vImage.src = pFoto;
	imageBOX('<img border="0" src="' + pFoto + '" />', vImage.width, pTekstveld);
  
	return false;
}

function swfPopup(mylink, windowname)
{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string') href=mylink;
	else href=mylink.href;
	
	window.open(href, windowname, 'width=580,height=500,scrollbars=no');
	return false;
}
