function toon_geenafbeelding(el) {
	if (el)
		el.src = '/images/dot_clear.gif';
}

//open links in nieuw venster
function LinksInNewWindow(el) {
	if (/\/admin\//.test(document.location))
		return false;
	
	element = document.getElementById(el);
	if (!element)
		return false;
	
	a = element.getElementsByTagName('A');
	for (el=0;el<a.length;el++) {
		a[el].target = '_blank';
	}
}


//openen afbeelding met popup
function vergroting (fileName) {
	popup('/popupimage.php?image='+fileName);
	return;
}

//voor openen redirect onderhoudswindow in admin
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var popupscherm=0;
function popup (filename, fileid, width, height, scrollbars, resizable, menubar, toolbar, status, location) {
	if (popupscherm && ! popupscherm.closed)	popupscherm.close();
	if (!filename || filename=="")				filename="http://www.nijhuis.nl";
	if (!fileid || fileid=="")					fileid="nijhuis";
	if (!width || width=="")					width="600";
	if (!height || height=="")					height="500";
	if (!scrollbars || scrollbars=="")			scrollbars="no";
	if (!resizable || resizable=="")			resizable="no";
	if (!menubar || menubar=="")				menubar="no";
	if (!toolbar || toolbar=="")				toolbar="no";
	if (!status || status=="")					status="no";
	if (!location || location=="")				location="no";
	popupscherm=0;
	var args = "height=" + height + ", width=" + width + ", scrollbars=" + scrollbars + ", resizable=" + resizable +  ", menubar=" + menubar + ", toolbar=" +toolbar + ", status=" + status + " ,location=" + location;
	popupscherm = open(filename, fileid, args);
	if (!InternetExplorer) 						popupscherm.focus();
}

function redirect() {
	popup ('/admin/redirect/index.php', 'nhredirect')
}
function abonnees() {
	popup ('/admin/modules/abonnees/index.php', 'abonnee')
}

//functies voor Kinderzoo (afspelen juiste filmpje)
	function setOnclicks() {
		if (/\/admin\//.test(document.location))
			return false;
		else {
			if (document)
				document.onclick = playMovie;
		}
	}
	
	function playMovie(e) {
		var target = (e||window.event).target || (e||window.event).srcElement; 
		if (target.id && target.id == 'flashanim_onclick2') {
			var setmovie = { movie:'/flash/kinderzoo_pingraak.swf',width:'733',height:'180',name:'flashPenquin',loop:'true',quality:'high',wmode:'opaque',majorversion:'6',build:'40'};
			googleTrackFile.trackManual('flash/pinquin_kinderzoo/raak.htm');
		} else {
			var setmovie = { movie:'/flash/kinderzoo_pingspelmis.swf',width:'733',height:'180',name:'flashPenquin',loop:'true',quality:'high',wmode:'opaque',majorversion:'6',build:'40'};
		}
		UFO.create(setmovie, 'flashPenquin');
	}

//benodigde functie voor foto overzichts bouwsteen
	var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
	var popupscherm=0;
	
	function popup_afbeelding(filename, fileid, width, height, scrollbars, resizable, menubar, toolbar, status, location) {
		if (popupscherm && ! popupscherm.closed)	popupscherm.close();
		if (!filename || filename=="")				filename="http://www.grundel.nl";
		if (!fileid || fileid=="")					fileid="Grundel";
		if (!width || width=="")					width="50";
		if (!height || height=="")					height="50";
		if (!scrollbars || scrollbars=="")			scrollbars="no";
		if (!resizable || resizable=="")			resizable="no";
		if (!menubar || menubar=="")				menubar="no";
		if (!toolbar || toolbar=="")				toolbar="no";
		if (!status || status=="")					status="no";
		if (!location || location=="")				location="no";
		popupscherm=0;
		var args = "height=" + height + ", width=" + width + ", scrollbars=" + scrollbars + ", resizable=" + resizable +  ", menubar=" + menubar + ", toolbar=" +toolbar + ", status=" + status + " ,location=" + location;
		popupscherm = open(filename, fileid, args);
		if (!InternetExplorer) 						popupscherm.focus();
	}

// Print functie (haalt bepaalde TD uit de maintable en gooit deze in een popup)
	function printPage(aantal,tdeen,tdtwee) {
		if (document.getElementById(tdeen))
			var print1 = document.getElementById(tdeen).innerHTML;
		if (document.getElementById(tdtwee))
			var print2 = document.getElementById(tdtwee).innerHTML;
		
		if (aantal ==  1)
			window.printgedeelte = '<table><tr><td>'+print1+'</td></tr></table>';
		else
			window.printgedeelte = '<table><tr><td valign=top>'+print1+'</td><td valign=top>'+print2+'</td></tr></table>';
	 
		//open popup en vul deze 
		var w = window.open('/print.html');
	}

//hoogte maintable instellen
	var isNav4, isNav6, isIE
	var isBrand = navigator.appName
	var agt = navigator.userAgent.toLowerCase()
	var navVer = parseInt(navigator.appVersion)
	var isNav4 = (isBrand == "Netscape" && navVer < 5) ? true : false
	var isNav6 = (isBrand == "Netscape" && navVer >= 5) ? true : false
	var isIE = ((agt.indexOf("msie") != -1) && (parseInt(navVer) >= 4)) ? true : false
	
	//haal hoogte window binnen
	function getInsideWindowHeight() {
		if (isNav4 || isNav6)
			return window.innerHeight
		else 
	 		return document.body.clientHeight
	}
	
	//this function will get the current/computed style in IE and Moz/FF
	function getStyle(obj,Attribute) {
		if (obj) {
			if (obj.currentStyle)
				var value = eval('obj.currentStyle.'+Attribute)
			else
				var value = eval('document.defaultView.getComputedStyle(obj, null).'+Attribute)
			return parseInt(value);
		}
	}

	function zetScrollHoogte() {
		setOnclicks(); //hang functie aan onclick event als document is geladen
		initGoogleTrackFile(); //activeer googleTrackFile
		
		if (typeof initLightbox == 'function')
			initLightbox(); //activeer lightbox
		
		var template = document.body.className;
		var divmaintable = document.getElementById('divmaintable');
		var maintable = document.getElementById('maintable');
		var mainsite = document.getElementById('mainsite');
		var navigatie = document.getElementById('navigatie');
		var flasholifant = document.getElementById('vpOlifant');
		var section9 = document.getElementById('section9');
		var section10 = document.getElementById('section10');
		var browserhoogte = getInsideWindowHeight();
		
		if (template == 'voorpagina') {
			if (divmaintable && maintable && flasholifant) {
				var totalehoogte = maintable.offsetHeight+getStyle(divmaintable,'top')+getStyle(flasholifant,'height');
				if (totalehoogte < browserhoogte) {
					maintable.style.height = browserhoogte - getStyle(divmaintable,'top') - getStyle(flasholifant,'height') - 3;
					divmaintable.style.height = browserhoogte - getStyle(divmaintable,'top') - getStyle(flasholifant,'height') - 3;
				}
			}
		} else { //vervolgpaginas
			if (divmaintable && maintable) {
				if ((maintable.offsetHeight + getStyle(divmaintable,'top')) > (navigatie.offsetHeight + getStyle(navigatie,'top')))
					var totalehoogte = maintable.offsetHeight + getStyle(divmaintable,'top');
				else
					var totalehoogte = navigatie.offsetHeight + getStyle(navigatie,'top');

				if (totalehoogte < browserhoogte) {
					maintable.style.height = browserhoogte - getStyle(divmaintable,'top');
					divmaintable.style.height = browserhoogte - getStyle(divmaintable,'top');
				} else {
					maintable.style.height = totalehoogte - getStyle(divmaintable,'top');
					mainsite.style.height = divmaintable.offsetHeight + getStyle(divmaintable,'top');
				}
			} else if (template == 'happenings') {
				if (section9 && section10) {
					if ((getStyle(divmaintable,'top') + section9.offsetHeight + section10.offsetHeight) > (navigatie.offsetHeight + getStyle(navigatie,'top')))
						var totalehoogte = getStyle(divmaintable,'top') + section9.offsetHeight + section10.offsetHeight;
					else
						var totalehoogte = navigatie.offsetHeight + getStyle(navigatie,'top');
					
					if (totalehoogte < browserhoogte) {
						section10.style.height = browserhoogte - getStyle(divmaintable,'top') - getStyle(section9,'height');
						mainsite.style.height = browserhoogte;
					} else {
						section10.style.height = totalehoogte - getStyle(divmaintable,'top') - getStyle(section9,'height');
						mainsite.style.height = totalehoogte;
					}
				}
			}
			if (document.getElementById('wereldreis'))
				if (browserhoogte < 791 + getStyle(document.getElementById('wereldreis'),'top'))
					mainsite.style.height = 791 + getStyle(document.getElementById('wereldreis'),'top');
		}
	}
	
	function initGoogleTrackFile() {
		if (/\/admin\//.test(document.location))
			return false;
		
		googleTrackFile.init('maintable');
	}

