var slider;
var show_date_count     = 0;
var audition_date_count = 0;

function add_show_date() {
  add_event_date('show', show_date_count);
  show_date_count = show_date_count + 1;
};

function add_audition_date() {
  add_event_date('audition', audition_date_count);
  audition_date_count = audition_date_count + 1;
};

function add_event_date(type, count) {
  var ul = $(type + "_dates");
  var new_id        = type + "_new_date_" + count.toString();
  var date_input_id = type + "_date_"     + count.toString();
  var time_input_id = type + "_date_"     + count.toString() + "_time";
  ul.insert({ bottom: 
      "<li id='" + new_id + "' class='show_date'>"  +
        "Date: <input type='text' id='" + date_input_id + "' " +
            "name='" + date_input_id + "' />" +
        "&nbsp;&nbsp;" +
        "Time: <input type='text' id='" + time_input_id + "' " +
            "name='" + time_input_id + "' />" +
        "&nbsp;&nbsp;" +
        "<a href='#' onclick='$(\"" + new_id + "\").remove();return false' >" +
            "<img src='/images/trash.gif' /></a>" +
      "</li>" });
};

function repaint_zebras(container) {
  var even = false;

  $(container).childElements().each(function(list_item) {
    if (even) {
      list_item.addClassName('even');
      list_item.removeClassName('odd');
    } else {
      list_item.addClassName('odd');
      list_item.removeClassName('even');
    }

    even = !even;
  });

  return true;
}

function clear_field(el, value) {
  if($F(el) == value) { $(el).clear(); }
}

function blur_field(el, value) {
  if(!$(el).present()) { $(el).setValue(value); }
}