
function selectInput1(d, p) {
	var nodes = p.split(",<");
	return nodes[0];
//	$("#ac1").flushCache();
} 
function selectInput2(d, p) {
	var nodes = p.split(",<");
	return nodes[0];
//	$("#ac2").flushCache();
}
function customRange(input) { 
	var d  = new Date();

	var d1 = new Date($("#startDate").datepicker("getDate"));

	var d2 = d1;
	if ( d.getTime() > d1.getTime() ) {
		d2 = d;
	}

	if (input.id == "startDate") {
    	return {minDate: (input.id == "startDate" ? d2 : null), 
        	maxDate: "2y"}; 
	} else {
    	return {minDate: (input.id == "endDate" ? d1 : null), 
        	maxDate: "2y"}; 
	}
} 


  $(document).ready(function(){
 
  $("#startDate,#endDate").datepicker({ 
    beforeShow: customRange,
    showOn : "both",
    buttonImage: "images/calendar.gif", 
    buttonImageOnly: true 
});

$("#ac1").autocomplete("/hcs", 
{ 
	minChars:3, 
	width:300, 
	scroll:true, 
	scrollHeight:200
	});
$("#ac2").autocomplete("/hcs", 
{ 
	minChars:3, 
	width:300, 
	scroll:true, 
	scrollHeight:200, 
	formatResult:selectInput2  
	});
  });

