// Global Functions
// global.js

function printerFriendly() {
// generates a printer friendly version of a page by reading
// the HTML between a defined tag
// by Jay Reid - Jan. 2002
// Modified CRP 2004

	if (document.getElementById("bodyContent"))
	{
		var contentLink = document.getElementById("bodyContent")
		var sHTMLToPrint = contentLink.innerHTML
		var sTitle = document.title
		//var sLocation = document.location

		if (sHTMLToPrint != "")
		{
			printWindow = window.open("", null, "location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=yes");
			printWindow.document.writeln("<HTML>\n<HEAD>\n");
			printWindow.document.writeln("<LINK HREF=\"/_layouts/EpcorInternetPublishing/en-ca/css/default_200906.css\" REL=\"stylesheet\" TYPE=\"text/css\">\n");
			printWindow.document.writeln("<LINK HREF=\"/_layouts/EpcorInternetPublishing/en-ca/css/layouts/centered1024_31.css\" REL=\"stylesheet\" TYPE=\"text/css\">\n");
			printWindow.document.writeln("<LINK HREF=\"/_layouts/EpcorInternetPublishing/en-ca/css/print.css\" REL=\"stylesheet\" TYPE=\"text/css\">\n");
//			printWindow.document.writeln("<style type=\"text/css\">@import url( /internet/Styles/advanced.css );</style>\n");
			printWindow.document.writeln("</HEAD>\n<BODY>\n");
			printWindow.document.writeln("<table cellspacing=\"0\" cellpadding=\"0\" width=\"700\" border=\"0\"><tr><td>\n");
			printWindow.document.writeln(sHTMLToPrint);
			printWindow.document.writeln("</td></tr></table>\n");
			//printWindow.document.writeln("<br><br>Originating Page:&nbsp;" + sLocation);
			printWindow.document.writeln("\n</BODY>\n</HTML>");
			printWindow.document.title = sTitle + " (Printer Friendly)";
			printWindow.focus();
		} 
		
		else
		{
			alert("An error occurred attempting to create a printer friendly page from the original document.\nThe original page may not be formatted properly or it's layout has changed.");
		}
	}
}

