/*########################################################################*\

	Developed by 		: Jerry van Heerikhuize
	Version				: 1.0.2
	Creation Date		: 2/7/06
	Modification Date	: donderdag; maart 1, 2007
	Creation by			: Jerry van Heerikhuize
	Modification by		: Loes Kalb
	Description			: Print function
	File				: print.js
	ID					: 9931711E-3689-4EC3-AC00-E139D163636B

	--------------------------------------------------------------------

	Example:
	
	<div id="printarea">content</div>
	
	<a href="javascript:printArea('printarea', 500, 575)">print</a>
	

\*########################################################################*/

printArea = function (id, w, h, pagetitle) {
	
	//alert (id);
	
	/* set popheight and width */
	var popup_height = h;
	var popup_width = w;	

	/* Center popup window */
	var intwidt;
	var intheight;

	intwidth = screen.availWidth;
	intheight = screen.availHeight;
	intwidth = parseInt (intwidth);
	intheight = parseInt (intheight);

	var element = document.getElementById(id);

	if (element == null) {
		
		alert("no print area defined");

	} else {

		var content = element.innerHTML;

		var w = window.open ('', '' ,'height=' + popup_height + ',width=' + popup_width + ',toolbar=no,scrollbars=yes')

		target = w.document;
		
		target.write ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>TNT</title><link rel="stylesheet" type="text/css" media="screen" href="../css/screen.css" /><link rel="stylesheet" type="text/css" media="print" href="../css/print.css" /><script type="text/javascript" src="../js/tnt.js"></script><script type="text/javascript">document.onLoad = window.print();</script></head><body><div id="content">');
		target.write (content);	
		target.write ('</div></body></html>');


		if (intwidth > 0 && intheight > 0){
			w.moveTo ( ( ( intwidth-popup_width ) / 2 ), ( ( intheight - popup_height ) / 2) );
		}

		w.focus();

	}
	
};



