var printWin=null;
var printWinTimeout;

function printThisPage(thisPrintArea)	{
	if (document.getElementById != null){
		var html = '<HTML>\n<HEAD>\n';
        html += '<title>ITRAC - Information Technology Recruitment and Contracting</title>\n';
		html += '<LINK href="itracstyle.css" type="text/css" rel="stylesheet">\n';

//		if (document.getElementsByTagName != null){	
//			var headTags = document.getElementsByTagName("head");
//			if (headTags.length > 0)
//				html += headTags[0].innerHTML + " \n";
//		}
		html += '\n</HEAD>\n<BODY>\n';

		html += '<TABLE cellSpacing="0" cellPadding="0" width="650" border="0">';
		html += '<TR> \n';
		html +=	'<TD><IMG src="images/ItracLogo.jpg" border="0" width="293" height="80"></TD>\n';
		html += '</TR> \n';
		html += '<TR width="650">\n';
		html += '<TD><IMG src="images/ItracGreenBar.jpg" border="0"></TD>\n';
		//Insert blank line
		html += '<TR> \n';
		html +=	'<TD>&nbsp; </TD>\n';
		html += '</TR> \n';

		//Main content start
		html += '<TR width="650">\n';
		html += '<TD>\n';
			
		var printReadyElem = document.getElementById(thisPrintArea);
		if (printReadyElem != null)	{
				html += printReadyElem.innerHTML;
		}
		else{
			alert("Could not find the printArea section in the HTML");
			return;
		}

		//Main content end
		html += '</TD>\n';
		html += '</TR> \n';

		//Footer
		html += '<TR width="650">\n';
		html += '<TD class="text_9px">\n';
		html += '<HR>\n';
		html += '&nbsp;&nbsp;Itrac Resources Pty Ltd<br>&nbsp;&nbsp;itrac@itrac.com.au\n';
		html += '</TD>\n';
		html += '</TR> \n';
		
		html += '</TABLE> \n';
		html += '\n</BODY>\n</HTML>';
		//alert(html);
		
		printFinished(); //Close existing print window if open
		
		printWin = window.open("","","height=8,width=7");
		printWin.document.open();
		printWin.opener.focus();
		printWin.moveTo(200,-500);
		printWin.document.write(html);
		printWin.document.close();
		printWinTimeout = setTimeout("printFinished()",15000)
		printWin.print();
	}
}

function printFinished()	{
	if (printWin != null)	{
		if (printWin.closed)	{
			printWin = null;
		}
		else{
			//alert("printWin is open");
			printWin.close();
			printWin = null;
			clearTimeout(printWinTimeout);
		}
	}
}

