function PrintReport() {
	ForPrint(this);
}

function ForPrint(x) {
	try {
		//alert('Rozpoczynam drukowanie');
		w = window.open('','printable');
//		document.getElementById('printSection').className='tekst_druk';
//		document.getElementById('printTable').className='tablereport';
		setTimeout("w.document.body.innerHTML=document.getElementById('printSection').innerHTML", 1110);

		setTimeout('w.print()', 1200);
		setTimeout('w.close()', 1200);
	}
	catch(Exception) {
		alert('Ta strona nie może zostać wydrukowana.');
	}
}

var gAutoPrint = true; // Flag for whether or not to automatically call the print function
// ----------------------------------------------------------------------------
function printSpecial() {
	PrintSpecialPart('printSection');
}
// ----------------------------------------------------------------------------
function PrintSpecialPart(partName) {
	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="css/report.css" rel="stylesheet" type="text/css">\n';
		html += '\n</HE' + 'AD>\n<BODY>\n';

//		var printReadyElem = document.getElementById("printSection");
		var printReadyElem = document.getElementById(partName);

		if (printReadyElem != null) {
//			html += document.getElementById('printPre').innerHTML;
			html += printReadyElem.innerHTML;
//			html += document.getElementById('printAfter').innerHTML;
		}
		else {
			alert("Could not find the printReady section in the HTML");
			return;
		}

		html += '\n</BO' + 'DY>\n</HT' + 'ML>';

//		var printWin = window.open("","printSpecial", "width=0,height=0");
		var printWin = window.open("", partName, "width=0,height=0");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();

		if (gAutoPrint) {
			printWin.print();
			printWin.close();
		}
	}
	else {
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}
// ----------------------------------------------------------------------------
function Export2Excel(p_document) {
	document.location = p_document + '?export2excel=true';
}
// ----------------------------------------------------------------------------
