function show(what)
{
  el = document.getElementById(what).style;
  el.display = 'block';
}

function hide(what)
{
  el = document.getElementById(what).style;
  el.display = 'none';
}

function getAppVersion() 
{
  appname = navigator.appName;
  appversion = navigator.appVersion;
  majorver = appversion.substring(0, 1);
  if ( (appname == "Netscape") && ( majorver >= 3 ) ) return 1;
  if ( (appname == "Microsoft Internet Explorer") && (majorver >= 4) ) return 1;
  return 0;
}

function ResizeTextArea(t)
{
  a = t.value.split('\n');
  //if(getAppVersion()) b = 3; else 
  b = 1;
  for(x = 0; x < a.length; x++) 
  {
    if(a[x].length >= t.cols) b += Math.floor(a[x].length / t.cols);
  }
  b += a.length;
  //if(b > t.rows) 
  t.rows = b;
} 

function confirmAction(theMessage)
{
  // TODO: Confirmation is not required in the configuration file
  // or browser is Opera (crappy js implementation)
  if (typeof(window.opera) != 'undefined') 
  {
    return true;
  }

  var is_confirmed = confirm(theMessage);

  return is_confirmed;
}

onload = function()
{
  if (document.getElementsByClassName == undefined)
  {
    document.getElementsByClassName = function(className)
    {
      var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
      var allElements = document.getElementsByTagName("*");
      var results = [];

      var element;
      for (var i = 0; (element = allElements[i]) != null; i++)
      {
        var elementClass = element.className;
        if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
        results.push(element);
      }
      return results;
    }      
  }

  arr = document.getElementsByClassName('textedit');
  for(i = 0; i < arr.length; i++)
  {
    ResizeTextArea(arr[i]);
  }
}

function CheckAllCheckbox()
{
  ch = document.getElementById('CheckAll');
  arr = document.getElementsByClassName('CheckBox');
  for(i = 0; i < arr.length; i++)
  {
    arr[i].checked = ch.checked;
  }
 return(false);
}