// --------------------------------- vars ---------------------------------

photo_border_width=7;
photo_border_color='#FFFFFF';

photo_padding_width=1;
photo_padding_color='#D2A713';

photo_speed=0.2;
photo_nifty_controls=1;

unloading = false;

// --------------------------------- usage ---------------------------------

// pic[0]=new Array(filename,width,height,subscript,date)
// pic[1]=new Array(filename,width,height,subscript,date)

// <A HREF="javascript:loadphotoarray(0)">popup</A>
// <A HREF="javascript:loadphoto(filename,width,height,subscript,date)">popup</A>



// --------------------------------------------------------------------------

ie = /MSIE ((5\.5)|[678])/.test(navigator.userAgent);
win = navigator.platform == "Win32";

ie7 = navigator.appVersion.indexOf("MSIE 7.0") != -1;

prev=999; next=999;
thisfoto = 1;
function $(o) { return document.getElementById(o); }
function loadphotoarray(p, i) {
	thisfoto = i;
	if (p=="next" || p=="prev") p=eval(p);
	if (p!=999) {
		hidephoto();
		wait();
		if (p>0) prev=p-1; else prev=999;
		if (p+1<pic[i].length) next=p+1; else next=999;
		n=pic[i].length;
		loadphoto(pic[i][p][0],pic[i][p][1],pic[i][p][2],pic[i][p][3],pic[i][p][4],prev,next);
	}
}
function loadphotoarray2(p) {
	loadphotoarray(p, thisfoto);
}
function loadphoto(url,w,h,s,d) {
	wait();
	document.images["bigphoto"].width=w;
	document.images["bigphoto"].height=h;
	document.images["bigphoto"].src=url;
	document.getElementById("photodiv3").innerHTML=s;
	document.getElementById("photodiv3").style.display=((s==""&&d=="")?"none":"inline");
	xy=d.substring(0,4);
	xm=d.substring(4,6);
	xd=d.substring(6,8);
	xh=d.substring(8,10);
	xi=d.substring(10,12);
//	document.getElementById("photodiv4").innerHTML="<NOBR>&nbsp;&nbsp;"+xd+"/"+xm+"/"+xy+"&nbsp;-&nbsp;"+xh+":"+xi+"</NOBR>";
	document.getElementById("photodiv4").style.display=((s==""&&d=="")?"none":"inline");;
	if (photo_nifty_controls==1) {
		if (prev == 999 && next == 999) {
			document.getElementById("photodiv5").innerHTML='<IMG SRC="/dummy.gif" WIDTH=20 HEIGHT=20 BORDER=0>';
			document.getElementById("photodiv6").innerHTML='<IMG SRC="/dummy.gif" WIDTH=20 HEIGHT=20 BORDER=0>';
		} else {
			document.getElementById("photodiv5").innerHTML='<IMG SRC="/'+taal+'/aanbod/icon_prev'+(prev==999?"off":"")+'.gif" WIDTH=20 HEIGHT=20 BORDER=0>';
			document.getElementById("photodiv6").innerHTML='<IMG SRC="/'+taal+'/aanbod/icon_next'+(next==999?"off":"")+'.gif" WIDTH=20 HEIGHT=20 BORDER=0>';
		}
	}
}
function centerphoto() {
	dv=document.getElementById("bigphotodiv");
	dv.style.width=520+(photo_padding_width*2+photo_border_width*2);
	dv.style.height=390+(photo_padding_width*2+photo_border_width*2);

	dv=document.getElementById("photodiv1");
	dv.style.width=520;
	dv.style.height=390;
	dv.style.left=photo_border_width+photo_padding_width;
	dv.style.top=photo_border_width+photo_padding_width;

	//close icon
	dv=document.getElementById("photodiv2");
	dv.style.left=520-(photo_border_width+photo_padding_width+8);
	dv.style.top=photo_padding_width+photo_border_width+4;

	//prev + next icon
	dv=document.getElementById("photodiv7");
	dv.style.left=photo_border_width+photo_padding_width+4;
	dv.style.top=photo_padding_width+photo_border_width+4;

	// subscript
	dv=document.getElementById("photodiv3");
	dv.style.left=7;
	dv.style.width=513+(photo_padding_width*2+photo_border_width*2);
	dv.style.height=34;
	dv.style.top=document.getElementById("bigphotodiv").style.height;

	dv=document.getElementById("photodiv4");
	dv.style.left=0;
	dv.style.height=34;
	dv.style.width=document.getElementById("bigphotodiv").style.width;
	dv.style.top=document.getElementById("bigphotodiv").style.height;

	dv=document.getElementById("bigphotodiv");
	h=document.body.clientHeight;
	t=document.body.scrollTop;
	w=document.body.clientWidth;
	l=document.body.scrollLeft;
	y=Math.floor(h/2-dv.offsetHeight/2+t);
	x=Math.floor(w/2-dv.offsetWidth/2+l);
	dv.style.top=y;
	dv.style.left=x;
	dv.style.zIndex = 9999999;
}
function hidephoto() {
	dv=document.getElementById("bigphotodiv");
	dv.style.visibility="hidden";
	unwait();
}
function showphoto() {
	dv=document.getElementById("bigphotodiv");
	fadeIn("bigphotodiv",photo_speed);
}
function fixcenter() {
	centerphoto();
}
function wait() {
	if (!unloading) {
		unloading = true;
		if (ie || 1==1) {
			pw = document.body.scrollWidth;
			ph = document.body.scrollHeight;
			cw = document.body.clientWidth;
			ch = document.body.clientHeight;
			sl = document.body.scrollLeft;
			st = document.body.scrollTop;
		}
		$('wait').style.width = pw;
		$('wait').style.height = ph;
		$('wait').style.zIndex = 9999998;
		$('wait').style.visibility = "visible";
	}
}
function unwait() {
	unloading = false;
	$('wait').style.visibility = "hidden";
}
function fadeIn(whatdiv, speed) {
	if (document.all) {
		$(whatdiv).style.filter = "blendTrans(duration=" + speed + ")";
		$(whatdiv).filters.blendTrans.apply();
		$(whatdiv).style.visibility = "visible";
		$(whatdiv).filters.blendTrans.play();
	} else {
		$(whatdiv).style.opacity = 0;
		$(whatdiv).style.mozOpacity = 0;
		$(whatdiv).style.visibility = "visible";
		for (i = 0.1; i <= 1; i += 0.025) {
			window.setTimeout("$('" + whatdiv + "').style.opacity=" + i, i * 1000 * speed);
			window.setTimeout("$('" + whatdiv + "').style.mozOpacity=" + i, i * 1000 * speed);
		}
	}
}

function fadeOut(whatdiv,speed) {
	if (document.all) {
		$(whatdiv).style.filter = "blendTrans(duration=" + speed + ")";
		$(whatdiv).filters.blendTrans.apply();
		$(whatdiv).style.visibility = "hidden";
		$(whatdiv).filters.blendTrans.play();
	} else {
		$(whatdiv).style.opacity = 0;
		$(whatdiv).style.mozOpacity = 0;
		$(whatdiv).style.visibility = "visible";
		for (i = 0.1; i <= 1; i += 0.025) {
			window.setTimeout("$('" + whatdiv + "').style.opacity=" + (0.9 - i), i * 1000 * speed);
			window.setTimeout("$('" + whatdiv + "').style.mozOpacity=" + (0.9 - i), i * 1000 * speed);
		}
	}
}

document.write('<DIV ID="bigphotodiv" STYLE="position:absolute;left:-999;top:-999;background:#FFFFFF;visibility:hidden">');

document.write('<DIV ID="photodiv0" STYLE="position:absolute;left:0;top:0">');
	document.write('<TABLE CELLPADDING='+photo_padding_width+' CELLSPACING=0 BORDER=0 STYLE="background:'+photo_padding_color+(photo_border_width>0?(';border:'+photo_border_width+'px solid '+photo_border_color):'')+'"><TR><TD>');
	document.write('<IMG SRC="/dummy.gif" WIDTH=520 HEIGHT=390 BORDER=0><BR>');
	document.write('</TD></TR></TABLE>');
document.write('</DIV>');

document.write('<DIV ID="photodiv1" STYLE="position:absolute;left:0;top:0">');
	document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100% HEIGHT=100% STYLE="background:'+photo_border_color+'"><TR VALIGN=CENTER><TD ALIGN=CENTER>');
	document.write('<IMG NAME="bigphoto" SRC="/dummy.gif" onLoad="if (this.src.indexOf(\'dummy.gif\')==-1) { centerphoto();showphoto() }"><BR>');
	document.write('</TD></TR></TABLE>');
document.write('</DIV>');

document.write('<DIV ID="photodiv4" STYLE="position:absolute;left:0;top:0;background:#FFFFFF;width:60px;color:#000000;height:29;padding-top:4;font-family:arial,helvetica;font-size:12px;font-weight:bold;"></DIV>');

document.write('<DIV ID="photodiv3" STYLE="position:absolute;left:0;top:0;background:#FFFFFF;width:60px;color:#000000;height:29;padding-top:4;font-family:arial,helvetica;font-size:12px;font-weight:bold;"></DIV>');

if (photo_nifty_controls==1) {

	document.write('<DIV ID="photodiv2" STYLE="position:absolute;left:0;top:0;width:20px">');
		document.write('<A HREF="javascript:hidephoto()"><IMG SRC="/'+taal+'/aanbod/icon_close.gif" WIDTH=20 HEIGHT=20 BORDER=0></A>');
	document.write('</DIV>');

	document.write('<DIV ID="photodiv7" STYLE="position:absolute;left:0;top:0;width:44px">');

		document.write('<TABLE CELLPADDING=0 CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=44>');
		document.write('<TR>');
			document.write('<TD WIDTH=20><A HREF="javascript:loadphotoarray2(\'prev\')" ID="photodiv5"><IMG SRC="/'+taal+'/aanbod/icon_prev.gif" WIDTH=20 HEIGHT=20 BORDER=0></A></TD>');
			document.write('<TD WIDTH=4></TD>');
			document.write('<TD WIDTH=20><A HREF="javascript:loadphotoarray2(\'next\')" ID="photodiv6"><IMG SRC="/'+taal+'/aanbod/icon_next.gif" WIDTH=20 HEIGHT=20 BORDER=0></A></TD>');
		document.write('</TR>');
		document.write('</TABLE>');
		
	document.write('</DIV>');

} else {

	document.write('<DIV ID="photodiv2" STYLE="position:absolute;left:0;top:0;background:#800000;padding:1 5 1 5;border:1px solid black">');
	document.write('<A HREF="javascript:hidephoto()" STYLE="color:white;font-family:tahoma,arial;font-size:11px;text-decoration:none">Sluiten</A><BR>');
	document.write('</DIV>');

}

document.write('</DIV>');



window.onresize=fixcenter;



