var timeoutHnd;
var gridimgpath;

function createjGrid() {
	$("#bigset").jqGrid({        
		url:'/includes/getReferencesOverview.php5',
		datatype: "json",
		height: "auto",
		colNames:['Project','Application', 'Category', 'Date', 'Download'],
		colModel:[
			{name:'ProjectName',index:'ProjectName', width:202,resizable:false},
			{name:'Application',index:'Application', width:232,resizable:false},
			{name:'Category',index:'CategoryID', width:112,resizable:false},
			{name:'Date',index:'DateEnd', width:80,resizable:false},
			{name:'Download', index:'none', width:130,sortable:false,resizable:false}			
		],
		rowNum:-1,
		width:"100%",
		//   	rowList:[10,20,30],
		imgpath: gridimgpath,
		mtype: "POST",
		//pager: $('#pagerb'),
		//loadonce: true,
		autowidth: true,
		
		sortname: 'DateEnd',
		viewrecords: true,
		altRows: true,
		sortorder: "desc"
	});
}

function doSearch(ev){ 
	if(timeoutHnd)
		clearTimeout(timeoutHnd)
	timeoutHnd = setTimeout(gridReload,500)
}

function gridReload(){
	var CountryID = $("#CountryID").val();
	var CategoryID = $("#CategoryID").val();
	var Application = $("#Application").val();
	$("#bigset").setGridParam({url:"/includes/getReferencesOverview.php5?CountryID="+CountryID+"&CategoryID="+CategoryID+"&Application="+Application,page:1}).trigger("reloadGrid");
}

