
    $(function(){

      $('.star').click(function(){
        if (!$(this).hasClass('no-click')) {
          $(this).nextAll().addClass('star-off');
          $(this).prevAll('.star').andSelf().removeClass('star-off');
          $(this).siblings('input').val($(this).prevAll('.star').length + 1);
        }
        return false;
      });

      //$('input.from-date').val('');
      //$('input.to-date').val('');

      $('input.from-date').datepicker({
        minDate: new Date(),
        onSelect: function(dateText, inst) {

          var mindate = dateText.split('/')
          $(this).siblings('input.to-date').datepicker('option', 'minDate', new Date(mindate[2],mindate[1] - 1,mindate[0])).val('');
        }

      });

      $('input.to-date').datepicker({
        minDate: new Date()
      });

      $('a.to-date').click(function(){
        $(this).siblings('input.to-date').datepicker('show');
        return false;
      });

      $('a.from-date').click(function(){
        $(this).siblings('input.from-date').datepicker('show');
        return false;
      });
      
      $('.more_types').toggle(
        function () {
          var id = $(this).attr('value');
          $(this).removeClass('more_rooms_show').addClass('more_rooms_hide');
          var value = $('.hotel_row_th_'+id).attr('value').split('_');
          $('.hotel_row_th_'+id).attr('rowspan', 1*value[1] + 1);          
          $('.hotel_left_col_th_'+id).attr('rowspan', 1*value[1] + 1);          
          $('.hidden_room_'+id).show();
          return false;
        },
        function () {
          var id = $(this).attr('value');
          $(this).removeClass('more_rooms_hide').addClass('more_rooms_show');
          var value = $('.hotel_row_th_'+id).attr('value').split('_');
          $('.hotel_row_th_'+id).attr('rowspan', value[0]);          
          $('.hotel_left_col_th_'+id).attr('rowspan', value[0]);          
          $('.hidden_room_'+id).hide();
          return false;
        }
      );

      $('#reset_button').click(function(){
        $(this).parents('form').find('input[type=checkbox]').removeAttr('checked');
        $('#metro-list').html('');
        metro.resetAll();
        $(this).parents('form').find('input[type=text], input[type=hidden], textarea').val('');
        return false;
      });

            
    });



