﻿// JScript File

function printIt(tableID) {
	var tableHTML="<tr><td colspan='2' valign='top'>"+document.getElementById(tableID).outerHTML+"</td></tr>";
	var tableHeight=parseInt(document.getElementById(tableID).offsetHeight);
	var tableWidth=parseInt(document.getElementById(tableID).offsetWidth);
	var exWidth=70;
	var exHeight=100;
	if(tableWidth+exWidth>650)
		tableWidth=650-exWidth;
	if(tableHeight+exHeight>600)
		tableHeight=600-exHeight;
	var topHTML="";
	var links=document.getElementsByTagName("LINK");
	var styles="";
	for(i=0;i<links.length;i++) {
		styles+=links[i].outerHTML+"\n";
	}
	topHTML+="<html>\n<head><style>.classchap{color:#333333;font-size:10px}\n td, input, select, textarea, a {font-family:tahoma;font-size:8pt;}</style>\n<title>محدوده چاپ</title>\n";
	topHTML+="<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>\n";
	topHTML+=styles;
	topHTML+="\n</head>\n<body>\n";
	var botHTML="\n</body>\n</html>";
	
	var features="top=100,left=100,width="+(tableWidth+exWidth)+",height="+(tableHeight+exHeight)+",resizable=1,scrollbars=1";
	var printWindow= window.open('','przone',features);
	
	printWindow.document.open();
	printWindow.document.write(topHTML+tableHTML+botHTML);
	printWindow.document.close();
	
	printWindow.print();
}

