// --------------------------------- vars ---------------------------------

photo_border_width=50;
photo_border_color='#FFFFFF';

photo_padding_width=0;
photo_padding_color='#FFFFFF';

photo_speed=0.2;
photo_nifty_controls=1;

unloading = false;
geresized = 0;

// --------------------------------- 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);
saf = /Safari/.test(navigator.userAgent);
win = navigator.platform == "Win32";

ie7 = navigator.appVersion.indexOf("MSIE 7.0") != -1;

prev=0; next=0;
function $(o) { return document.getElementById(o); }
function loadphotoarray(p) {
	if (p=="next" || p=="prev") p=eval(p);
	if (p!=999) {
		hidephoto();
		wait();
		if (p>0) prev=p-1; else prev=(pic.length-1);
		if (p+1<pic.length) next=p+1; else next=0;
		loadphoto(pic[p][0],pic[p][1],pic[p][2],pic[p][3],pic[p][4],prev,next);
	}
}
function loadphoto(url,w,h,s,d) {
	wait();
	document.images["bigphoto"].width=w;
	document.images["bigphoto"].height=h;
	
	if(h<w) { 
	
	document.images["bigphoto"].width=619;
	document.images["bigphoto"].height=412;
	
	}
	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=(d==""?"none":"inline");
	if (photo_nifty_controls==1) {
		if (prev == 999 && next == 999) {
			document.getElementById("photodiv5").innerHTML='<IMG SRC="/dummy.gif" WIDTH=15 HEIGHT=15 BORDER=0>';
			document.getElementById("photodiv6").innerHTML='<IMG SRC="/dummy.gif" WIDTH=15 HEIGHT=15 BORDER=0>';
		} else {
			document.getElementById("photodiv5").innerHTML='<IMG SRC="/images/icon_prev_off.gif" WIDTH=30 HEIGHT=48 BORDER=0 onMouseOver="this.src=\'/images/icon_prev_on.gif\';" onMouseOut="this.src=\'/images/icon_prev_off.gif\';">';
			document.getElementById("photodiv6").innerHTML='<IMG SRC="/images/icon_next_off.gif" WIDTH=30 HEIGHT=48 BORDER=0 onMouseOver="this.src=\'/images/icon_next_on.gif\';" onMouseOut="this.src=\'/images/icon_next_off.gif\';">';
		}
	}
}

function centerphoto() {

	dv=document.getElementById("bigphotodiv");
	dv.style.width=924;
	dv.style.height=512;
	if (geresized != 1) dv.style.visibility="visible";

	dv=document.getElementById("photodiv1");	//div die foto bevat
	dv.style.left=(document.getElementById("bigphotodiv").offsetWidth-photo_padding_width*2-photo_border_width*2-document.images["bigphoto"].width)/2;
	dv.style.top=(document.getElementById("bigphotodiv").offsetHeight-photo_padding_width*2-photo_border_width*2-document.images["bigphoto"].height)/2;
	if (geresized != 1) dv.style.visibility="visible";

	dv=document.getElementById("photodiv2"); // div die controls bevat
	dv.style.left=0;
	dv.style.top=(document.getElementById("bigphotodiv").offsetHeight-photo_padding_width*2-photo_border_width*2)/2;
//	dv.style.width=document.images["bigphoto"].width+(photo_padding_width*2+photo_border_width*2);
	if (geresized != 1) dv.style.visibility="visible";

	dv=document.getElementById("photodiv3");  // div die omschrijving bevat
	dv.style.left=(document.getElementById("bigphotodiv").offsetWidth/2)-(document.images["bigphoto"].width/2);
	dv.style.width=document.images["bigphoto"].width;
	dv.style.bottom=(photo_padding_width+photo_border_width)-dv.offsetHeight;
	if (geresized != 1) dv.style.visibility="visible";

	dv=document.getElementById("photodiv4");  // div die extra info bevat
	dv.style.left=(photo_padding_width+photo_border_width);
	dv.style.top=(photo_padding_width+photo_border_width)+document.images["bigphoto"].height-(ie ? 23 : 27);
	if (geresized != 1) dv.style.visibility="visible";

	dv=document.getElementById("photodiv5");
	if (geresized != 1) dv.style.visibility="visible";
	dv=document.getElementById("photodiv6");
	if (geresized != 1) dv.style.visibility="visible";

	dv=document.getElementById("photodiv7");  // div die sluitknop bevat
	dv.style.right=10;
	dv.style.top=10;
	if (geresized != 1) dv.style.visibility="visible";

	if (document.getElementById("photodiv2").style.visibility == "visible") {
		if (bezoekurl != '') document.getElementById('bezoeklink').style.display = "inline";
		if (woonclipurl != '') document.getElementById('wooncliplink').style.display = "inline";
	}

	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);
	if (ie) x -= 9;
	if (saf) x += 12;
	dv.style.top=y;
	dv.style.left=x;
	dv.style.zIndex = 9999999;

	if (geresized == 1) geresized = 0;
}

function loadextras(type, url) {
	wait();
	
	document.getElementById('bezoek').src = "";
	document.getElementById('woonclip').src = "";
	document.getElementById('bezoekdiv').style.visibility = "hidden";
	document.getElementById('woonclipdiv').style.visibility = "hidden";
	document.getElementById('bezoeklink').style.display = "none";
	document.getElementById('wooncliplink').style.display = "none";

	document.getElementById(type).src = url;
//	document.getElementById(type).style.width = 619;
//	document.getElementById(type).style.height = 412;
	document.getElementById(type+'div').style.visibility = "visible";

	if (bezoekurl != '' && type == 'woonclip') {
		document.getElementById('bezoeklink').style.display = "inline";
	}
	if (woonclipurl != '' && type == 'bezoek') {
		document.getElementById('wooncliplink').style.display = "inline";
	}

	centerextras(type);
}

function centerextras(type) {
	dv=document.getElementById("bigphotodiv");
	if (type == 'bezoek') {
		dv.style.width=924;
		dv.style.height=570;
	} else {
		dv.style.width=924;
		dv.style.height=512;
	}
	dv.style.visibility="visible";

	dv=document.getElementById(type+"div");	//div die extras (bezoek of woonclip) bevat
	if (type == 'bezoek') {
		dv.style.left=photo_padding_width+photo_border_width+(document.getElementById("bigphotodiv").offsetWidth-photo_padding_width*2-photo_border_width*2-document.getElementById(type).offsetWidth)/2;
		dv.style.top=photo_padding_width+photo_border_width+15+(document.getElementById("bigphotodiv").offsetHeight-photo_padding_width*2-photo_border_width*2-document.getElementById(type).offsetHeight)/2;
	} else {
		dv.style.left=photo_padding_width+photo_border_width+(document.getElementById("bigphotodiv").offsetWidth-photo_padding_width*2-photo_border_width*2-document.getElementById(type).offsetWidth)/2;
		dv.style.top=photo_padding_width+photo_border_width+(document.getElementById("bigphotodiv").offsetHeight-photo_padding_width*2-photo_border_width*2-document.getElementById(type).offsetHeight)/2;
	}

	dv=document.getElementById("photodiv1");	//div die foto bevat
	dv.style.visibility="hidden";

	dv=document.getElementById("photodiv2"); // div die controls bevat
	dv.style.visibility="hidden";

	dv=document.getElementById("photodiv3");  // div die omschrijving bevat
	dv.style.visibility="hidden";

	dv=document.getElementById("photodiv4");  // div die extra info bevat
	dv.style.visibility="hidden";

	dv=document.getElementById("photodiv5");
	dv.style.visibility="hidden";

	dv=document.getElementById("photodiv6");
	dv.style.visibility="hidden";

	dv=document.getElementById("photodiv7");  // div die sluitknop bevat
	dv.style.right=10;
	dv.style.top=10;
	dv.style.visibility="visible";

	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);
	if (ie) x -= 9;
	if (saf) x += 12;
	dv.style.top=y;
	dv.style.left=x;
	dv.style.zIndex = 9999999;
}
function hidephoto() {
	dv=document.getElementById("photodiv1");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv2");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv3");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv4");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv5");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv6");
	dv.style.visibility="hidden";
	dv=document.getElementById("bezoek");
	dv.src="/dummy.gif";
	dv=document.getElementById("bezoekdiv");
	dv.style.visibility="hidden";
	dv=document.getElementById("woonclip");
	dv.src="/dummy.gif";
	dv=document.getElementById("woonclipdiv");
	dv.style.visibility="hidden";
	unwait();
}
function hidebox() {
	dv=document.getElementById("photodiv1");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv2");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv3");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv4");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv5");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv6");
	dv.style.visibility="hidden";
	dv=document.getElementById("photodiv7");
	dv.style.visibility="hidden";
	dv=document.getElementById("bezoek");
	dv.src="/dummy.gif";
	dv=document.getElementById("bezoekdiv");
	dv.style.visibility="hidden";
	dv=document.getElementById("woonclip");
	dv.src="/dummy.gif";
	dv=document.getElementById("woonclipdiv");
	dv.style.visibility="hidden";
	dv=document.getElementById("bigphotodiv");
	dv.style.visibility="hidden";
	unwait();
}
function showphoto() {
	dv=document.getElementById("bigphotodiv");
	fadeIn("bigphotodiv",photo_speed);
}
function fixcenter() {
	geresized = 1;
	centerphoto();
}
function wait() {
	if (!unloading) {
		unloading = true;
		if (ie) {
			pw = document.body.scrollWidth-17;
			ph = document.body.scrollHeight;
			$('fixme').style.visibility = "hidden";
		} else {
			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 = 99999;
		$('wait').style.visibility = "visible";
	}
}
function unwait() {
	unloading = false;
	$('wait').style.visibility = "hidden";
	if (ie) {
		$('fixme').style.visibility = "visible";
	}
}
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;width:924px;height:512px;background:#FFFFFF;visibility:hidden">');

document.write('<DIV ID="photodiv1" 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 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="bezoekdiv" STYLE="position:absolute;left:0;top:0;visibility:hidden;">');
	document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 STYLE="background:'+photo_padding_color+'"><TR><TD>');
	document.write('<IFRAME NAME="bezoek" ID="bezoek" SRC="/dummy.gif" WIDTH=750 HEIGHT=530 ALIGN=TOP FRAMEBORDER="0" VSPACE="0" HSPACE="0" SCROLLING="no"></IFRAME>');
	document.write('</TD></TR></TABLE>');
document.write('</DIV>');

document.write('<DIV ID="woonclipdiv" STYLE="position:absolute;left:0;top:0;visibility:hidden;">');
	document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 STYLE="background:'+photo_padding_color+'"><TR><TD>');
	document.write('<IFRAME NAME="woonclip" ID="woonclip" SRC="/dummy.gif" WIDTH=640 HEIGHT=435 ALIGN=TOP FRAMEBORDER="0" VSPACE="0" HSPACE="0" SCROLLING="no"></IFRAME>');
	document.write('</TD></TR></TABLE>');
document.write('</DIV>');

document.write('<DIV ID="photodiv3" STYLE="position:absolute;left:0;bottom:0;background:#FFFFFF;width:60px;color:#000000;text-align:center;height:23;padding-top:4;font-family:Trebuchet MS,Helvetica,sans-serif;font-size:12px;"></DIV>');

document.write('<DIV ID="photodiv4" STYLE="position:absolute;left:0;bottom:0;background:#FFFFFF;width:60px;color:#000000;height:23;padding-top:4;font-family:Trebuchet MS,Helvetica,sans-serif;font-size:12px;"></DIV>');

if (photo_nifty_controls==1) {

	document.write('<DIV ID="photodiv2" STYLE="position:absolute;left:0;top:0;width:924px;height:48px;text-align:center;">');

		document.write('<TABLE CELLPADDING=0 CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=924 ALIGN=CENTER>');
		document.write('<TR>');
			document.write('<TD WIDTH='+photo_border_width+'><IMG SRC="/dummy.gif" WIDTH='+photo_border_width+' HEIGHT=48 BORDER=0></TD>');
			document.write('<TD WIDTH=30><A HREF="javascript:loadphotoarray(\'prev\')" ID="photodiv5"><IMG SRC="/images/icon_prev.gif" WIDTH=30 HEIGHT=48 BORDER=0></A></TD>');
			document.write('<TD WIDTH='+(924-60-(photo_border_width*2))+'><IMG SRC="/dummy.gif" WIDTH='+(924-60-(photo_border_width*2))+' HEIGHT=48 BORDER=0></TD>');
			document.write('<TD WIDTH=30><A HREF="javascript:loadphotoarray(\'next\')" ID="photodiv6"><IMG SRC="/images/icon_next.gif" WIDTH=30 HEIGHT=48 BORDER=0></A></TD>');
			document.write('<TD WIDTH='+photo_border_width+'><IMG SRC="/dummy.gif" WIDTH='+photo_border_width+' HEIGHT=48 BORDER=0></TD>');
		document.write('</TR>');
		document.write('</TABLE>');
		
	document.write('</DIV>');
}

document.write('<DIV ID="photodiv7" STYLE="position:absolute;right:0;top:0;height:20px;"><NOBR>');
document.write('<A ID="bezoeklink" HREF="javascript:loadextras(\'bezoek\', \''+bezoekurl+'\');" STYLE="color:#000000;font-family:Trebuchet MS,Helvetica,sans-serif;font-size:12px;text-decoration:none;">'+(bezoekurl!=''?'<IMG SRC="/images/play.gif" WIDTH=15 HEIGHT=15 BORDER=0> '+label_virtueelbezoek+'':'')+'</A> &nbsp; ');
document.write('<A ID="wooncliplink" HREF="javascript:loadextras(\'woonclip\', \''+woonclipurl+'\');" STYLE="color:#000000;font-family:Trebuchet MS,Helvetica,sans-serif;font-size:12px;text-decoration:none;">'+(woonclipurl!=''?'<IMG SRC="/images/play.gif" WIDTH=15 HEIGHT=15 BORDER=0> '+label_woonclip+'':'')+'</A> &nbsp; ');
document.write('<A HREF="javascript:hidebox()" STYLE="color:#000000;font-family:Trebuchet MS,Helvetica,sans-serif;font-size:12px;text-decoration:none"><IMG SRC="/images/close.gif" WIDTH=15 HEIGHT=15 BORDER=0> '+label_sluiten+'</A><BR>');
document.write('</NOBR></DIV>');

document.write('</DIV>');



window.onresize=fixcenter;
