var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printSpecial()
{
        if (navigator.appName == 'Netscape'){
		alert('Erro, seu browser não aceita esse comando!!!');
		return false();
	}
	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</HE' + 'AD>\n<BO' + 'DY onLoad=\'setTimeout(\"window.close()\",50);\'>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Não foi possível imprimir o documento.");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
              
		var printWin = window.open("","printSpecial","scrollbars=no,toolbar=no,statusbar=no,menubar=no,resizeable=no,width=1,height=1,left=0,top=3000");
                printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();

		if (gAutoPrint) 
	{
			printWin.print();
	}
	}
	else
	{
		alert("Ocorreu um erro ao tentar imprimir esta página. Talvez a versão do seu navegador não suporte esta operação.");
	}

}

