//Print Page functionality -- adds workaround for ie4 (pc) and graceful error handling for macs

//to call this function, first include the .js the use the following notation:
//<a href="#" onclick="return printPage();">

//The wierd names are to avoid naming problems
var a_mac=(navigator.userAgent.indexOf("Mac") != -1);	//1 if Macintosh
var ie4x=0;
	
if (document.all && !window.print && !a_mac) //true on on IE4 (Windows) 
{
	ie4x=1;	
}
function printPage()
{
	if (window.print)	//Takes care of printing on NS4, NS6, IE5, IE6
	{
		window.print();
	}
	else if (ie4x)
	{
		vbPrintPage();
	}
	else
	{
		alert("Sorry, your browser doesn't support this feature. To print, from the File menu, select Print.");
	}
	
	return false;
}

if (ie4x) with (document)	//Written into the page to create a printable object for IE4 (Windows)
{
	write('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
	write('<' + 'SCRIPT LANGUAGE="VBScript">');
	write('Sub window_onunload');
	write('  On Error Resume Next');
	write('  Set WB = nothing');
	write('End Sub');
	write('Sub vbPrintPage');
	write('  OLECMDID_PRINT = 6');
	write('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
	write('  OLECMDEXECOPT_PROMPTUSER = 1');
	write('  On Error Resume Next');
	write('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
	write('End Sub');
	write('<' + '/SCRIPT>');
}


