$(document).ready(function(){
  //nice looking submit buttons
  $( ".button" ).button();

  //initiate datepickers
  //$('#check_in').datepicker({altField : "#check_out"});
  //$('#check_out').datepicker();
  var date = new Date();
  //alert(date);
  
  $('#check_in').datepicker({ minDate : 0, onSelect: function(dateText, inst) {  $('#check_out').datepicker( "option", "minDate", dateText  ); } });
  $('#check_out').datepicker();
  //$( ".selector" ).datepicker( "option", "minDate", new Date(2007, 1 - 1, 1) );
   
  //initiate rooms accordion, call setchecked method when its clicked 
  $('#room_list').accordion({
      change: function(event, ui) { 
        setChecked ($("input",ui.newHeader)); }
  }); 
   
   //bind calendar icons to their fields
   $('#inCal').click(function(){
      $('#check_in').focus();
   });
   $('#outCal').click(function(){
      $('#check_out').focus();
   });
   

 });
 
var setChecked = function(oThis) {
    setTimeout(function(){
      $(oThis).attr("checked","checked");
     },10);
  };
