/*
addPrintLink function by Roger Johansson, www.456bereastreet.com - Amended by Richard Jones
*/
var addPrintLink = {
	init:function(sTargetEl,sLinkText) {
		if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
		if (!document.getElementById(sTargetEl)) {return;} // Check that the target element actually exists
		if (!window.print) {return;} // Check that the browser supports window.print
		var oTarget = document.getElementById(sTargetEl);
		var oList = document.createElement('li');
		var oLink = document.createElement('a');
		var oSpan = document.createElement('span');
		oList.className = 'print'; //added to allow new print icon to be displayed (JH 18/04/08)
		oLink.href = '#'; // Make the link focusable for keyboard users
		oSpan.appendChild(document.createTextNode(sLinkText));
		oLink.onclick = function() {window.print(); return false;} // Return false prevents the browser from following the link and jumping to the top of the page after printing
		oLink.appendChild(oSpan);
		oList.appendChild(oLink);
		var oPosition = oTarget.childNodes[2]; // Determine where to insert the print link list item
		if(!oPosition) {
			var oPosition = oTarget.lastChild; // This is alternative positioning calculation for IE because it's rubbish
		}
		oTarget.insertBefore(oList,oPosition); // Insert the print link list item in between the other two list items
	},
/*
addEvent function included here for portability. Replace with your own addEvent function if you use one.
*/
/* addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html */
	addEvent:function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
//addPrintLink.addEvent(window, 'load', function(){addPrintLink.init('print','Print');});
Event.onDOMReady(function(){addPrintLink.init('print_func','Print');});
