function printElement(printId,printStylesheet) {
	var iframe = document.getElementById('tempprint');
	var printObj = document.getElementById(printId);
	if(document.getElementById('tempprint') == null)  {
		var td = printObj.parentNode;
		iframe = document.createElement('IFRAME');
		iframe.id="tempprint";
		iframe.style.cssText = 'position:absolute; width:0px; height:0px; left:-5px; top:-5px;';
		td.appendChild(iframe);
	}

	var doc = null;
	doc = iframe.contentWindow.document;

	doc.open();
	if (printStylesheet) {
		doc.write('<link rel="stylesheet" type="text/css" href="'+printStylesheet+'" />' + printObj.innerHTML);
	}
	else {
		doc.write(printObj.innerHTML);	
	}
	
	doc.close();

	iframe.contentWindow.focus();
	iframe.contentWindow.print();
}

function printPage(pageUrl) {
	try {
		var now = new Date();
		var callback =
		{
			success: printPageSuccess,
			failure: printPageFailure
		}
		if(pageUrl == null) {
			pageUrl = document.location.href;
		}
		pageUrl += (((pageUrl.indexOf("?")!=-1)?"&":"?")+"noCache="+now.getTime()+"&op=makePrintable");
		YAHOO.util.Connect.asyncRequest("GET", pageUrl, callback, "");
	}
	catch(e) {
		alert('Er is iets misgegaan. Foutcode:'+e);
	}

}

function printPageSuccess(o) {
	var iframe = document.getElementById('tempprint');
	if(document.getElementById('tempprint') == null)  {
		iframe = document.createElement('IFRAME');
		iframe.id="tempprint";
		iframe.style.cssText = 'position:absolute; width:0px; height:0px; left:-5px; top:-5px;';
		document.body.appendChild(iframe);
	}

	var doc = null;
	doc = iframe.contentWindow.document;

	doc.open();
	doc.write(o.responseText);	
	doc.close();

	iframe.contentWindow.focus();
	iframe.contentWindow.print();
}

function printPageFailure(o) {
	alert('Er is iets misgegaan. Foutcode:'+o.statusText);
}