/* Benodigde functies voor redirect module */
function redirect() {
	popup ('/admin/redirect/index.php', 'nhredirect')
}

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";
	popupscherm=0;
	var args = "height="+height+",width="+width+",scrollbars=no,resizable=no,menubar=no,toolbar=no,status=no,location=no";
	popupscherm = open(filename, fileid, args);
	if (!InternetExplorer)
		popupscherm.focus();
}

//voorkom het submitten van een form door ENTER-gebruik in tekstveld [NB]
function setFormElementsNoEnter() {
	var table = document.getElementById('maintable');
	if (!table) { return; }
	var inputfields = table.getElementsByTagName("INPUT");
	for (var i = 0; i < inputfields.length; i++) {
		if (inputfields[i].type == 'text') {
			inputfields[i].onkeypress = function() {
				if (window.event.keyCode == 13)
					return false;
			}
		}
	}
}

//functies voor het printen
function printen() {
	if (!document.getElementById('printcontent'))
		return false;
	
	//haal rechterkolom van maintable
	window.printgedeelte = document.getElementById('printcontent').innerHTML;
	window.printgedeelte = '<div id="logo_print"><img src="/images/logo.jpg" alt="0" border="0"></div><br><br>' + window.printgedeelte;
	
	//disable de links om bladeren via printversie te voorkomen
	window.printgedeelte = window.printgedeelte.replace(/href/gi,"hrefdisabled");
	window.printgedeelte = window.printgedeelte.replace(/onclick/gi,"onclickdisabled");

	//open nieuwe popup en plaats maintable hierin
	var w =  window.open('/print.html');
}

//Instellen van de hoogte van de div 'divMaintable'

//definieren variabelen
var isNav6;
var isBrand = navigator.appName;
var navVer = parseInt(navigator.appVersion);
var isNav6 = (isBrand == "Netscape" && navVer >= 5) ? true : false;

//give back the computed style
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);
	}
	}
	
//haal hoogte window binnen
function getInsideWindowHeight() {
	if (isNav6)
		return window.innerHeight
 	else 
		return document.body.clientHeight
}

//resize de div
function zetScrollHoogte() {
	schermhoogte = getInsideWindowHeight();
	var site = document.getElementById('mainsite');
	
	if (site) {
		var sitetop		= getStyle(site,'top');
		var siteheight	= site.offsetHeight + sitetop;
	
		if (siteheight < schermhoogte)
			site.style.height = schermhoogte - sitetop;
	}
}

//window.onresize = zetScrollHoogte;

// Maak zoekveld leeg als men het aanklikt
function LeegVeld() {
	document.zoeken.search_for.value = '';
}