var printerwin;

function printme(id){
		if(typeof id == 'undefined')
			id='printme';
			
		printerwin=window.open('','printer','height=500,width=560,scrollbars=1,resizable=1');

		var tmp = printerwin.document
		var title = $('#inpg .titl').text(); //was html() SeRG
		var url = window.location.href;

		var text_for_print='<h3 align="center">' + title + '</h3>';
		if (typeof id != 'undefined'){
			//printerwin.document.getElementById('bodyprinter').innerHTML = '<h3>' + title + '</h3><div>' + $('#'+id).html() + '</div>';
			text_for_print= text_for_print + '<div>' + $('#'+id).html() + '</div>';
		} else {
			//printerwin.document.getElementById('bodyprinter').innerHTML = '<h3>' + title + '</h3><div>' + $('#printme').html() + '</div>';
			text_for_print= text_for_print + '<div>' + $('#'+id).html() + '</div>';
		}


		tmp.write('<html><head><title>'+ title +'</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
		tmp.write('<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />');
		tmp.write('<link rel="stylesheet" href="/dec/css/style.css" type="text/css" media="screen" />');
		tmp.write('<link rel="stylesheet" href="/dec/css/ua-firefox.css" type="text/css" media="screen" />');
		tmp.write('<script type="text/javascript" src="/dec/javascript/jquery.js"></script>');
		tmp.write('<style type="text/css" media="screen">html,body{ margin: 0; width: 560px;} table{ font-size: 11px !important;} .print_pop_hide{ display: none;}</style>');
		tmp.write('<style type="text/css" media="print">table{ font-size: 11px !important;} .print_hide, .print_pop_hide{ display: none;}</style>');
		tmp.write('</head>');

		tmp.write('<body><div style="margin: 10px;"><img src="/dec/img/logo_en.gif" alt="" /><br/><p><b>Site link: </b>'+url+'</p><div id="bodyprinter">'+text_for_print+'</div><br/><br/><a href="javascript:print();" class="print_hide">Print</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:window.close();" class="print_hide">Close window</a><br/>&nbsp;</div>');
		tmp.write('<script type="text/javascript">$(".tblgrey").css("display","none");</script>');
		tmp.write('</body></html>');
		tmp.close();

/*
		if (typeof id != 'undefined'){
			printerwin.document.getElementById('bodyprinter').innerHTML = '<h3>' + title + '</h3><div>' + $('#'+id).html() + '</div>';
		} else {
			printerwin.document.getElementById('bodyprinter').innerHTML = '<h3>' + title + '</h3><div>' + $('#printme').html() + '</div>';
		}
		*/
		//printerwin.document.title = title;
		//printerwin.print();
		//printerwin.close();

}