<!-- This script may be freely distributed. -->
<!-- as long as these headers are left in place. -->

<!-- Momp's Web Design -->
<!-- http://www.mompswebdesign.com -->

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

function printFriendly(obj, largura, cabecalho, rodape)
{
	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 += "<link href='/temas/default/css/style_pt.css' rel='stylesheet'>\n";
		html += '<style>body{background-color:#FFFFFF; color:#000;} #linkTohide{display: none;} input{display: none;} .toHide{display:none} .ocultTable{display: block; background-color: #eeeeee;} .tabelaOrcamentos .linhaTitulo{background-color:#FFFFFF;} .tabelaOrcamentos, .tabelaOrcamentos td{border: solid 1px #000} .tabelaOrcamentos .linhaCenter, .tabelaOrcamentos .linhaLeft, .tabelaOrcamentos .linhaRight{background-color:#FFFFFF;}</style>';
		html += '<style type="text/css">.itemCab{color: #000000;} #detalheAmbiente{background-color:#FFFFFF; }</style>';
		html += '\n</he' + 'ad>\n<body>\n';
		html += "<table border='0' width='100%'><tr><td>";
        html += "<img src='/fotos/email_templates/" + cabecalho + "' border='0'>";
		html += "</td></tr><tr><td>";
		
		
		html += '<style>#dontprintme, #dontprintme2{visibility:hidden;display:none;}</style>';
		
		var printPageElem = document.getElementById(obj);
		
		if (printPageElem != null)
		{
				html += printPageElem.innerHTML;
		}
		else
		{
			alert("There is no section to print in the HTML");
			//alert("Could not find the printFriendly section in the HTML");
			return;
		}
		html += "</td></tr><tr><td><img src='/fotos/email_templates/" + rodape + "' border='0'></td></tr></table>"	
		html += '\n</bo' + 'dy>\n</ht' + 'ml>'; 
		
		
		
		var printWin = window.open("","printFriendly", "width=" + largura + ",height=500,scrollbars=yes");//,scrollbars=yes
		printWin.document.open();
		printWin.document.write(html);
		
		printWin.document.close();
		
		//if (gAutoPrint)
		   printWin.print();
		//printWin.close();
	}
	else
	{
		alert("Sorry, it is not possible to print the document.");
	}
}

