function openwindow(url, name, w, h) {
  l = (screen.availWidth-10 - w) / 2;
  t = (screen.availHeight-20 - h) / 2;

  features = "width="+w+",height="+h+",left="+l+",top="+t;
  features += ",screenX="+l+",screenY="+t;
  features += ",scrollbars=1,resizable=1,location=0";
  features += ",menubar=0,toolbar=0,status=0";

  window.open(url, name, features);
}

function openurl(url) 
{
    document.location = url;
}

function checkall(check_form, check_name, checked) {
  var i;
  for (i=0; check_form.elements[i]; i++)
  {
    if (check_form.elements[i].type == "checkbox" &&
    check_form.elements[i].name == check_name)
    {
      check_form.elements[i].checked = checked;
    }
  }
}

function disableall(check_form, check_name, disabled) {
  var i;
  for (i=0; check_form.elements[i]; i++)
  {
    if (check_form.elements[i].type == "checkbox" &&
    check_form.elements[i].name == check_name)
    {
      check_form.elements[i].disabled = disabled;
    }
  }
}

  function hideDiv(id)
  {
    var element = document.getElementById(id);
    element.style.display = "none";
  }
  function showDiv(id)
  {
    var element = document.getElementById(id);
    element.style.display = "block";
  }
  function toggleDiv(id)
  {
    var element = document.getElementById(id);
    if (element.style.display == "block" || element.style.display == "")
    {
      element.style.display = "none";
    }
    else
    {
      element.style.display = "block";
    }
  }

  function getCurrentTime()
  {
    var a_p = "";
    var d = new Date();
    
    var curr_hour = d.getHours();
    
    if (curr_hour < 12)
    {
      a_p = "AM";
    }
    else
    {
      a_p = "PM";
    }
    if (curr_hour == 0)
    {
      curr_hour = 12;
    }
    if (curr_hour > 12)
    {
      curr_hour = curr_hour - 12;
    }
    
    var curr_min = d.getMinutes();
    var curr_sec = d.getSeconds();

    curr_hour = curr_hour + "";
    if (curr_hour.length == 1)
    {
      curr_hour = "0" + curr_hour;
    }
    curr_min = curr_min + "";
    if (curr_min.length == 1)
    {
      curr_min = "0" + curr_min;
    }
    curr_sec = curr_sec + "";
    if (curr_sec.length == 1)
    {
      curr_sec = "0" + curr_sec;
    }

    return curr_hour + ":" + curr_min + ":" + curr_sec + " " + a_p;
  }

    function clearSelectOptions(OptionList) 
    {
       // Always clear an option list from the last entry to the first
       for (x = OptionList.length; x >= 0; x = x - 1) {
          OptionList[x] = null;
       }
    }

    function appendSelectOption(OptionList, OptionValue, OptionText) 
    {
       // Add option to the bottom of the list
       OptionList[OptionList.length] = new Option(OptionText, OptionValue);
    }
