// Onload handler

// document.observe("dom:loaded", function() {
//   $$('.js_hide').invoke('hide');
//   $$('.js_show').invoke('show');
// });

// Nifty round corners. http://www.html.it/articoli/niftycube/

NiftyLoad = function() {
  // round
  Nifty("div.round", "big");
  Nifty("div.round_top", "big top");
  Nifty("div.round_tr", "big tr");
  Nifty("div.round_right", "big right");
  Nifty("div.round_br", "big br");
  Nifty("div.round_bottom", "big bottom");
  Nifty("div.round_bl", "big bl");
  Nifty("div.round_left", "big left");
  Nifty("div.round_tl", "big tl");
  // same-height
  // Nifty("span.same_height_subheader", "same-height");
  // Nifty("ul#subheader li","same-height");
}

// Custom

// Toggles an element's visibility, typically with a checkbox
function toggle_display(eid, bool) {
  $(eid).style.display = bool ? 'none' : 'block';
}

// Removes a new object from a form (so it doesn't get saved)
function remove_new_entry(element, parent_class_name) {
  element.up('.'+parent_class_name).remove();
}

// Finds the enclosing form from obj (used for CSS buttons)
function find_form(obj) {
  while (obj.tagName != "FORM") {
    obj = obj.parentNode;
  }
  return obj;
}
