
// Copyright (C) 2009 Aaron Merriman. All rights reserved.

function validate_events() {
 if (document.forms['ch_events'].events_text.value.replace(/^\s+|\s+$/g,'').length < 1) {
  if (confirm('You are about to save an empty events file.\nAll existing events will be lost. Continue?')) {
   document.forms['ch_events'].submit();
  } else {
   document.forms['ch_events'].events_text.focus();
  }
 } else {
  document.forms['ch_events'].submit();
 }
}

function site_error(error_type,error_msg,error_val) {
 var error_sol = "";
 if (error_val == 0) {
  error_sol = "If this condition persists, please <a href=\"/Contact-Us.php\">contact us</a> to report the problem.</div>";
 } else {
  error_sol = "Contact site administrator for resolution.</div>";
 }
 document.write("<div id=\"critical_error\">\n<h1 class=\"input_error\">" + error_type + " Error</h1>\n<b>" + error_msg + "</b>\n" + error_sol);
}

