<% include_dhtmlx_scheduler_headers_tags %>
<div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:500px'>
  <div class="dhx_cal_navline">
    <div class="dhx_cal_prev_button">&nbsp;</div>
    <div class="dhx_cal_next_button">&nbsp;</div>
    <div class="dhx_cal_today_button"></div>
    <div class="dhx_cal_date"></div>
    <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
    <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
    <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
  </div>
  <div class="dhx_cal_header">
  </div>
  <div class="dhx_cal_data">
  </div>
</div>
<% content_for :header_tags do %>
  <script type="text/javascript">
    function initDhtmlxScheduler() {
      scheduler.config.xml_date = "%Y-%m-%d %H:%i";
      scheduler.config.touch = "force";
      scheduler.config.prevent_cache = true;
      scheduler.config.first_hour = 4;
      scheduler.config.limit_time_select = true;
      scheduler.config.details_on_create = true;
      scheduler.config.details_on_dblclick = true;
      scheduler.config.full_day = true;
      scheduler.config.occurrence_timestamp_in_utc = true;
      scheduler.config.include_end_by = true;
      scheduler.config.repeat_precise = true;

      scheduler.config.lightbox.sections = [
        {name: "description", height: 130, map_to: "text", type: "textarea", focus: true},
        {name: "location", height: 43, type: "textarea", map_to: "details"},
        {name: "type", height: 21, map_to: "type", type: "select", options: scheduler.serverList("type")},
        {name: "recurring", type: "recurring", map_to: "rec_type", button: "recurring"},
        {name: "time", height: 72, type: "time", map_to: "auto"}
      ];

      scheduler.init('scheduler_here', new Date(), "day");
      scheduler.load("<%= easy_rooms_dhtmlx_scheduler_path(@easy_room, :format => :json) %>", "json");

      var dp = new dataProcessor("<%= easy_rooms_dhtmlx_scheduler_path(@easy_room, :format => :json) %>");
      dp.init(scheduler);
    }

    $(document).ready(function () {
      initDhtmlxScheduler();
    });
  </script>
<% end %>