var modcari=(function(){
	var datakey=[];
	var dataget={};
	return{
		init:function(a){
			datakey=[];
			for (var key in a) {
			 	datakey.push(key);
			}
			dataget=a;
			$("#keterangan_modcari").html("");
			if(dataget.hasOwnProperty("mcari")){
				$("#keterangan_modcari").html("Hasil pencarian dengan kata kunci <b>\""+dataget['mcari']+"\"</b> ... <span class='hapusflt_modcari' onclick='modcari.hapusflt()'>Hapus filter pencarian</span>");
			}
		},
		hapusflt:function(){
			$("#bt_modcari").val("");
			modcari.cari();
		},
		dataget:function(){
			return dataget;
		},
		enter:function(e){
			if(e.which == 13 || e.keyCode == 13){
				modcari.cari();
			}
		},
		cari:function(){
			var flt=$("#bt_modcari").val();
			if(flt!="") {
				dataget['mcari']=flt;
			}else{
				if(dataget.hasOwnProperty("mcari")) delete dataget['mcari'];
			}
			
			var strcari="";
			var n=0;
			for (var key in dataget) {
				if(key!="page" && key!="hal"){
					if(n==0){
				 		strcari=strcari+"?"+key+"="+dataget[key];
				 	}else{
				 		strcari=strcari+"&"+key+"="+dataget[key];
				 	}
				 	n++;
				}
			}
			
			var url=lokal;
			if(dataget.hasOwnProperty("hal")){
				
				url=url+dataget['hal'];
				console.log(strcari);
			}
			document.location=url+strcari;
		}
	};
})();
