
var gAutoPrint = false; // Flag for whether or not to automatically call the print function

function printFriendly()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">\n';

		var printPageElem = document.getElementById("printFriendlyTop");
		
		if (printPageElem != null)
		{
				html += printPageElem.innerHTML;
		}
		else
		{
			alert("Could not find the printFriendlyTop section in the HTML");
			return;
		}

		
		var printPageElem = document.getElementById("printFriendly");
		
		if (printPageElem != null)
		{
				html += printPageElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}


		
		html += '<p><font size="-3">&copy; The College of Nanoscale Science and Engineering The University at Albany</font>';

			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printFriendly");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the printer friendly feature works\nonly in javascript enabled browsers.");
	}
}



