function openwindow(url,title,properties) {
  mywin = window.open(url,title,properties);
}
var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printpreview() {
	if (document.getElementsByTagName != null) {
		var html = '<html><head><title>Print preview</title>';
		var bodyTags = document.getElementsByTagName("body");
		var id = bodyTags[0].id;
		
		html += '<link rel="stylesheet" href="css/print.css" type="text/css" media="screen" />';
		html += '</head>';
		if (id != '') {
			html += '<body id="' + id + '">';
		} else {
			html += '<body>';
		}
		html += bodyTags[0].innerHTML;
		html += '</body></html>';
		
		var printWin = window.open("",'printSpecial','toolbar=no,location=no,left=1,top=5,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=775,height=600');
		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.");
	}
}