//
// addPrintButton.js
//
// Versie 1.0, 5 mei 2009
//
// Copyright: Roger Jolly, 2009
// This work is licensed under a Creative Commons Attribution-Noncommercial 3.0 Unported License
// http://creativecommons.org/licenses/by-nc/3.0/
//
// Dit script zorgt ervoor dat er een printbutton wordt toegevoegd aan de pagina. Dit is gedaan
// in javascript, omdat de button alleen functioneert als javascript beschikbaar is.
//

(function() {
	var theId = "printbutton";
	
	function init() {
		var theDiv = document.getElementById(theId);
		if (!theDiv) return false;
		
		theDiv.className = "";
		theDiv["onclick"]= new Function("e", "window.print()");
		
		// Kijk of er een globale variabele gedefinieerd is, waaruit blijkt dat we met ie6 te maken hebben.
		// Zo ja, voeg dan wat extra styling toe als de muis boven de div hangt..
		if(window.isIE6) {
			theDiv["onmouseout"]= new Function("e", "this.className=''");
			theDiv["onmouseover"]= new Function("e", "this.className='iehover'");
		}
		theDiv.title = "Print deze pagina";
		var aTextNode = document.createTextNode("print");
		theDiv.appendChild(aTextNode);
		aTextNode = null;
	};

	// Zorg dat init wordt aangeroepen als de pagina is geladen.
	if (window.addEventListener) {
		window.addEventListener("load", init, false);
	} else if (window.attachEvent) {
		window.attachEvent("onload", init);
	} else {
		window.onload = init;
	}
})(); // Roep de functie aan nu hij gedefinieerd is.

