function plop(wat,b,h) {
	var wat2 = "/plopop/" + wat + ".htm";
	b = Math.max(b, 400); h = Math.max(h, 400);
	window.open(wat2,'plop_op','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + b + ',height=' + h + ',screenX=115,screenY=15,top=15,left=115')
}

function post() {
window.open('mail.htm','post','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=420,screenX=115,screenY=15,top=15,left=115')
}

function laadrolkasj() {
   	var img1 = new Image();
   	img1.src = "/pix/menu_actueel_op.jpg";
   	var img2 = new Image();
   	img2.src = "/pix/menu_kunstenaars_op.jpg";
	var img3 = new Image();
   	img3.src = "/pix/menu_sieraden_op.jpg";
   	var img0 = new Image();
   	img0.src = "/pix/menu_galerie_op.jpg";
   	var img4 = new Image();
  		img4.src = "/pix/menu_agenda_op.jpg";
   	var img5 = new Image();
  		img5.src = "/pix/menu_contact_op.jpg";
}

var js = !(((navigator.appName.toLowerCase() == "microsoft internet explorer")&&(navigator.appVersion.substring(0,1) < "3"))||((navigator.appName.toLowerCase() == "netscape")&&(navigator.appVersion.substring(0,1) < "3")));
var TimeoutID;

function mouseOver(name) {
	if (js) {
		clearTimeout(TimeoutID);
		buttonname = name;
		document[buttonname].src = "/pix/menu_" + buttonname + "_op.jpg";
	}
}

function mouseOut(name) {
	if (js) {
		document[name].src = "/pix/menu_" + name + "_af.jpg";
	}
}

if (js) { laadrolkasj(); }

if (window.location.href.indexOf("plopop") > -1) {
   window.focus();
   timerID=setTimeout('window.close()',30000)
}	

function doeWissel() {
	nav = navigator.appVersion;
//	if (document.getElementById && document.getElementById("wissel").innerHTML && (nav.substring(nav.indexOf("MSIE")+5, nav.indexOf("MSIE") + 8) > "5.0")) {
	if (document.getElementById && document.getElementById("wissel").innerHTML) {
		deze = (deze < wissel.length -1? deze +1 : 0);
		document.getElementById("wissel").innerHTML = wissel[deze];
	}
}

var d = document;
// var beeldmap = "http://" + location.hostname + "/beeld/";
var beeldmap = "http://www.novantanove.nl/beeld/";
function openscherm() {
	// argumenten: titel, url, padding, bgkleur, imgborder
	// vb:  onClick="openscherm('hee hoi','vranken01_250hoog.jpg',5,'red',2); return false"
	// titel en url zijn verplicht, de overige facultatief
	var padding = (arguments.length > 2 && arguments[2] > '')? arguments[2] : 0;
	var bgkleur = (arguments.length > 3 && arguments[3] > '')? arguments[3] : "#FFF";
	var imgborder = (arguments.length > 4 && arguments[4] > '')? arguments[4] : 0;
	var extrar = padding + imgborder;
	plaatjeScherm = window.open('', '',
		'menubar=no,status=no,location=no,resizable=yes,scrollbars=no,width=400,height=400');
	with (plaatjeScherm.document) {
		writeln('<html><head><title>' + arguments[0] + '</title>');
		writeln('<meta http-equiv="imagetoolbar" content="no">');
		writeln('<script type="text/javascript">var d = document;');
		writeln('function pasplaatje() {if (d.all) {window.resizeTo(400,400);');
		writeln('w = 400 - (d.body.clientWidth - d.images[0].width) + ' + 2 * extrar);
		writeln('h = 400 - (d.body.clientHeight - d.images[0].height) + ' + 2 * extrar);
		writeln('window.resizeTo(w, h);');
		writeln('} else if (d.layers || d.getElementById) {');
		writeln('window.innerWidth = d.images[0].width + ' + 2 * extrar);
		writeln('window.innerHeight = d.images[0].height + ' + 2 * extrar);
		writeln('if (d.layers) window.onresize = window.reload;');
		writeln('} window.focus();timerID=setTimeout(\'window.close()\',30000)');
		writeln('}<\/script></head>');
		writeln('<body marginwidth="0" marginheight="0" style="margin: 0; padding: '+padding+'px; background-color: '+bgkleur+'; overflow: hidden" onLoad="pasplaatje();">');
		writeln('<img src="' + beeldmap + arguments[1] + '" border="'+imgborder+'">');
		writeln('</body></html>');
		close();
	}
}

function toonplaat(plaat, tekst) {
	var plaatjeScherm = window.open('', '',
		'menubar=no,status=no,location=no,resizable=yes,scrollbars=no,width=400,height=400');
	with (plaatjeScherm.document) {
		writeln('<html><head><title>Novanta Nove - image viewer</title>');
		writeln('<meta http-equiv="imagetoolbar" content="no">');
		writeln('<link href="/stijl/99-2.css" rel="stylesheet">');
		writeln('<script type="text/javascript">var d = document;');
		writeln('function pasplaatje() {');
		writeln('var w = d.images[0].width + 30');
		writeln('var h = d.images[0].height + 200');
		writeln('window.resizeTo(w, h);}');
		writeln('window.focus();timerID=setTimeout(\'window.close()\',30000)');
		writeln('<\/script></head>');
		writeln('<body marginwidth="0" marginheight="0" style="margin: 0; padding: 0; overflow: hidden" onLoad="pasplaatje();" class="popup">');
		writeln('<div align="center"><img src="' + beeldmap + plaat + '" border="' + (arguments.length == 3 ? '0' : '1') + '">');
		writeln('<p>'+ unescape(tekst) +'</p><p>[ <a href="javascript:window.close()">sluit dit venster</a> ]</p></body></html>');
		close();
	}
	
}


// meerdere onloads handelen
function addOnload(newFunction) {
	var oldOnload = window.onload;
	if (typeof oldOnload == "function") {
		window.onload = function() {
			if (oldOnload) {
				oldOnload();
			}
			newFunction();
		}
	}
	else {
		window.onload = newFunction;
	} 
}


function toonPlaatInDiv(plaat, tekst) {
	var bgDiv = document.getElementById('transpAchtergrondDiv');
	var fotoDiv = document.getElementById('fotoDiv');
	var pic = new Image; pic.src = plaat;
	fotoDiv.innerHTML = '<img src="' + plaat + '" border="' + (arguments.length == 4 ? arguments[3] : 1) + '">';
	fotoDiv.innerHTML += '<p>' + tekst + '</p>';
	fotoDiv.innerHTML += '<p align="center">[ <a href="#" onclick="sluitPlaatInDiv(); return false;">sluit</a> ]</p>';
	var rootElm = (document.documentElement && document.compatMode == 'CSS1Compat') ? document.documentElement : document.body;
	var vpw = self.innerWidth ? self.innerWidth : rootElm.clientWidth;
	var vph = self.innerHeight ? self.innerHeight : rootElm.clientHeight;
	bgDiv.style.height = Math.max(rootElm.scrollHeight, vph) + 'px';
	bgDiv.style.display = 'block';
	// fotoDiv.style.top = (rootElm.scrollTop + 55) + 'px';
	fotoDiv.style.left = '35%';
	if (arguments.length >= 3) {
		pic.width = arguments[2];
	}
	if (pic.width == 0) {
		pic.onload = function () { 
			fotoDiv.style.left = ((vpw - this.width) / 2) + 'px'; 
			fotoDiv.style.top = (rootElm.scrollTop + (vph - (this.height + 100))/2 ) + 'px';
		} ;
	} else {
		fotoDiv.style.left = ((vpw - pic.width) / 2) + 'px'; 
		fotoDiv.style.top = (rootElm.scrollTop + (vph - (pic.height + 100))/2 ) + 'px';
	}
	fotoDiv.style.display = 'block';
}
function sluitPlaatInDiv() {
	document.getElementById('transpAchtergrondDiv').style.display = 'none';
	document.getElementById('fotoDiv').style.display = 'none';
}
// platen preloaden
function platenPreloaden() {
	if (document.getElementById('fotoDiv')) {
		var aas = document.getElementsByTagName('a');
		for (var i = 0, aasL = aas.length; i < aasL; i++) {
			if (aas[i].href.substring(aas[i].href.lastIndexOf('.')) == '.jpg') {
				var pic = new Image; pic.src = aas[i].href;
			}
		}
	}
}
addOnload(platenPreloaden);

var slideshow = {
	deDiv: false,
	arrImages : [], // [['thumbUrl', 'bigUrl', 'text'], ['thumbUrl', 'bigUrl', 'text'], ...]
	nImages: 0,
	imgs: [],
	teller: 0,
	maxHoogte: 100,
	maxBreedte: 100,
	knoppen: '<p align="center">Klik op de foto voor een grotere versie<br><a href="#" onclick="ssVorige(); return false;">&laquo; vorige</a> | <a href="#" onclick="ssVolgende(); return false;">volgende &raquo;</a></p>',
	init: function (locID, arrStuff) {
		this.deDiv = document.getElementById(locID);
		this.arrImages = arrStuff;
		this.nImages = this.arrImages.length;
		for (var i = 0; i < this.nImages; i++) {
			this.imgs[i] = new Image(); this.imgs[i].onload = ssSetMaxima; this.imgs[i].src = this.arrImages[i][0];
		}
	},
	setMaxima : function () {
		for (var i =0, iL = this.imgs.length; i < iL; i++) {
			this.maxHoogte = Math.max(this.maxHoogte, this.imgs[i].height);
			this.maxBreedte = Math.max(this.maxBreedte, this.imgs[i].width);
		}
		this.vulDiv(0);
	},
	toonVolgende: function () {
		this.teller = this.teller + 1 >= this.nImages ? 0 : this.teller + 1;
		this.vulDiv(this.teller);
	},
	toonVorige: function () {
		this.teller = this.teller -1 > -1 ? this.teller - 1 : this.nImages - 1;
		this.vulDiv(this.teller);
	},
	vulDiv: function (i) {
		this.deDiv.innerHTML = '<div style="margin: 0 auto; width: ' + this.maxBreedte + 'px; height: ' + this.maxHoogte + 'px;"><a href="' + this.arrImages[i][1] + '" onclick="toonPlaatInDiv(this.href, \'' + this.arrImages[i][2] + '\'); return false;"><img src="' + this.arrImages[i][0] + '" style="border: 1px solid #000; margin-top: ' + ((this.maxHoogte - this.imgs[i].height)/2) + 'px; "></a></div>';
		this.deDiv.innerHTML += this.knoppen;
	}
	
};
function ssVolgende(){return slideshow.toonVolgende();}
function ssVorige(){return slideshow.toonVorige();}
function ssSetMaxima() {return slideshow.setMaxima();}
