function searchBoxesInit(){

$('#dateArrive').datepicker({showOn: 'both',
 buttonImageOnly: true,
 beforeShow: customRange,
 callBackOnClose: updateNightlyRate,
 buttonImage: 'http://www.rumblingbaldrentals.com/siteManager2/modules/rentals/images/icons/SM_cal_ico.png',
 buttonText: 'Choose Date',
 changeMonth: false,
 changeYear: false,
 minDate: 1,
 maxDate: 365
 });
 
  $('#dateDepart').datepicker({showOn: 'both',
 buttonImageOnly: true,
 beforeShow: customRange,
 callBackOnClose: updateNightlyRate,
 buttonImage: 'http://www.rumblingbaldrentals.com/siteManager2/modules/rentals/images/icons/SM_cal_ico.png',
 buttonText: 'Choose Date',
 changeMonth: false,
 changeYear: false,
 minDate: 1,
 maxDate: 365
 });

 // Customize two date pickers to work as a date range
 function customRange(input) {
 //console.info("in custom range.");
 return {minDate: (input.id == 'dateDepart' ? $('#dateArrive').datepicker('getDate'): 1),
 maxDate: (input.id == 'dateArrive' ? ($('#dateDepart').datepicker('getDate')!=null?$('#dateDepart').datepicker('getDate'):'1y') : '1y')};
 }
}



//make sure both arrival and departure date are filled in.
function validateForm() {
 if($('#dateRange').val()=="") {
 alert("You must select a date range to continue with your search");
 return false;
 }
}

//update nightly rate dropdown with ajax call to server
function updateNightlyRate() {
 //get values from the date boxes
 var dateArrive=$('#dateArrive').val();
 var dateDepart=$('#dateDepart').val();

 //check for blank inputs
 if(dateArrive!=""&&dateDepart!="") {
 $.getJSON("http://www.rumblingbaldrentals.com/searchHelper.php?task=getPricingRangeByDate&dateDepart="+dateDepart+"&dateArrive="+dateArrive,
 function(data){
 //console.info(data);
 $.each(data, function(i,item){
 //console.info("item "+i+": "+item);
 });
 });
 }
}