//popup voor modules binnen admin
if (/admin/.test(document.location.toString())) {
	top.window.popupReactiemodule = function () {
		popupModules('reageren_nieuwsitems');
	}
}
function popupModules(modulenaam) {
	var filename="/admin/modules/"+modulenaam+"/index.php";
	var fileid = "pp";
	var width="650";
	var height="580";
	var scrollbars="no";
	var resizable="no";
	var menubar="no";
	var toolbar="no";
	var status="no";
	var location="no";
	var popupscherm=0;
	var args = "height=" + height + ", width=" + width + ", scrollbars=" + scrollbars + ", resizable=" + resizable +  ", menubar=" + menubar + ", toolbar=" +toolbar + ", status=" + status + " ,location=" + location;
	popupscherm = top.window.open(filename, fileid, args);
}

//function to empty the formfield for the newsletter subscribe form on the onclick-event
function emptyFormField(el) {
	if (el) {
		if (el.value == 'uw voornaam')
			el.value = '';
		if (el.value == 'uw achternaam')
			el.value = '';
		if (el.value == 'uw e-mailadres')
			el.value = '';
	}
}

//crossbrowser bookmark function
function bookmark() { 
    var title = document.title;  
    var url = window.location.href; 

    if (window.sidebar) { // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title, url,"");
    } else if( window.external ) { // IE Favorite
        window.external.AddFavorite( url, title);
    } else {
		var desc = document.getElementById('bookmarks_desc');
		if (typeof desc == "object")
			desc.innerHTML = 'Helaas is het niet gelukt deze site als favoriet toe te voegen. U kunt het altijd zelf nog doen via uw browser';
    } 
}

// roep functie uit clientjs/styleswitcher.js aan
function initLettergrootte() {
	var cookie = readCookie("style");
	var title = cookie ? cookie : getPreferredStyleSheet();
	setActiveStyleSheet(title);
}

// plaats een klein icoontje voor een externe link en achter links die naar bestanden wijzen
function initLinks() {
	// voeg eventueel extra types (bestandsextenties toe)
	tagAhref.setType('docx');
	tagAhref.setType('xlsx');
	
	// plaats het icoontje links, ipv rechts
	tagAhref.left = true;
	
	// lijn het icoontje boven uit ipv onder
	tagAhref.top = '4px';
	
	// start met het toevoegen van icoontjes (geef evt rootnode op)
	tagAhref.init('maintable');
}

/**	Zet hoogte van de maintable goed **/
	var isNav4, isNav6
	var isBrand = navigator.appName
	var navVer = parseInt(navigator.appVersion)
	
	//browser check
	var isNav4 = (isBrand == "Netscape" && navVer < 5) ? true : false
	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 (isNav4 || isNav6)
			return window.innerHeight
	 	else 
		    return document.body.clientHeight
	}
	
	function setHeights() {
		var mainsite		= document.getElementById("mainsite");
		var maintable		= document.getElementById("maintable");
		var iframe			= document.getElementById("forum");
		var pagelink		= document.getElementById("pagelink");
		var schermhoogte 	= getInsideWindowHeight();
		if (maintable) {
			var maintabletop	= getStyle(maintable,'top');
			var maintableheight	= maintable.offsetHeight + maintabletop;
		}
		
		if (maintableheight < schermhoogte) {
			maintable.style.height = schermhoogte - maintabletop;
			mainsite.style.height = schermhoogte;
			pagelink.style.top = schermhoogte - 25;
			pagelink.style.display = 'block';
		} else {
			if (iframe)
				iframe.style.height = schermhoogte - getStyle(iframe,'top');
			else {
				mainsite.style.height = maintableheight;
				pagelink.style.top = maintableheight - 25;
				pagelink.style.display = 'block';
			}
		}
	}

/**	Verzamelfunctie die alle andere functies initialiseerd (indien het geen nieuwsbrieftemplate is) **/
function initAll(tid) {
	if (tid !== 2) {
		initLettergrootte();
		setHeights();
	}
}


