var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
			html += headTags[0].innerHTML;
		}

		html += '\n<link rel="stylesheet" type="text/css" href="/css/stylings.css" />\n</HEAD>\n<BODY style="background: #ffffff; padding: 20px;">\n';

		var printReadyElem = document.getElementById("printReady");

		if (printReadyElem != null)
		{
			html += '\n<div class="print-content-container">\n'
			html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady function");
			return;
		}

		var printReadyElem2 = document.getElementById("form");

		if (printReadyElem2 != null)
		{
			html += printReadyElem2.innerHTML;
			html += '\n<div class="form-container"><p><br /><br />All rights reserved. Copyright 2010 - 2011</p></div>\n';
			html += '\n</div>\n';
		}
		else
		{
			html += '\n</div>\n';
		}

		html += '\n</BODY>\n</HTML>';

		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
		}
		else
		{
			alert("The print ready feature is only available if you are using a browser. Please update your browser.");
		}
}