var cetak=(function(){
	var boxcetak=null;
	return{
		cetaksample:function(b){
			var judul = b['judul'] || "";
			var ps={"box":"box_cetak_single",
					"title":"Cetak Form "+judul,"tinggimax":"fit","tinggi":kudus.tinggifit()-300+"px","close":"tidak","top":"30px"};
			boxcetak=boxpesan.win(ps);
			$("#box_prevcetak_single").html("");
			
			
			$.get(lokal+"service.php?pos=cetak&mode=plg&fl="+b['lib'],b['data'],function(data){
			     $("#box_prevcetak_single").html(data);
		   	});
		   	
			document.getElementById("bt_tutup_single").onclick=function(){
				boxcetak.tutup();
				boxcetak=null;
			};
			
			document.getElementById("bt_cetak_single").onclick=function(){
				var mywindow = window.open('', judul, 'height=500,width=800');
		        mywindow.document.write('<html><head><title></title>');
		       	
		        mywindow.document.write('</head><body >');
		        mywindow.document.write($("#box_prevcetak_single").html());
		        mywindow.document.write('</body></html>');
		
		        mywindow.document.close(); 
		        mywindow.focus(); 
		
		        mywindow.onload=function(){
                    mywindow.print();
                    mywindow.close();
                };
		
		        return true;
			};
		},
		cetakdata:function(b){
			
			lib=b['lib'] || "";
			dataget=b['data'] || {};
			
			$.get(lokal+"service.php?mode=plg&pos=cetak&fl="+lib,dataget,function(data){
			    var sl=b['selesai'];
			    sl.selesai(data);
		   	});
		}
	};
})();
