function replaceChar(str, c, repTo)
  {
   if (!repTo)
     { repTo = new String(); }

   while (str.indexOf(c) > -1)
     { str = str.replace(c, repTo); }

   return (str);
  }

function toNumeric(str)
  {
   while (isNaN(str))
     {
      for (i = 0; i < str.length; i++)
        {
         if (isNaN(str.charAt(i)))
           {
            str = str.replace(str.charAt(i), "");
            break;
           }
        }
     }

   return (str);
  }

function replaceAll(str, character, newChar)
  {
   while (str.indexOf(character) > -1)
     { str = str.replace(character, newChar); }

   return (str);
  }

var request = { getParameter: new Function("param", "url", "return (Request(param, url))") };

function Request(querystring, url)
  {
   var querystr = [];
   urlStr = (url) ? url : window.location.href;
   locationStr = urlStr.substr(urlStr.indexOf("?") + 1).split("&");

   for (q = 0; q < locationStr.length; q++)
     {
      var query = locationStr[q].split("=");
      querystr[query[0]] = query[1];
     }

   if (!querystr[querystring])
     { return (null); }

   return (unescape(querystr[querystring]));
  }

function RowColorTable(tbl, color1, color2, offset)
  {
   var table = null;
   var color = color2;
   var offs = (typeof offset == "undefined") ? 0 : parseInt(offset);

   if (typeof tbl == "object")
     { table = tbl; }
   else if (typeof tbl == "string")
     { table = getById(tbl); }
   else
     { throw new Error("Invalid table."); }

   for (row = offs; row < table.rows.length; row++)
     { table.rows[row].style.backgroundColor = ((color.equals(color1)) ? (color = color2) : (color = color1)); }
  }

function hide(id)
  { getById(id).style.display = "none"; }

function show(id)
  { getById(id).style.display = ""; }

function upperCaseInput(obj)
  {
   if (obj == null)
     { return; }

   switch (obj.tagName.toUpperCase())
     {
      case ("INPUT"):
        {
         obj.value = obj.value.toUpperCase();
         break;
        }
      case ("TEXTAREA"):
        {
         obj.innerText = obj.innerText.toUpperCase();
         break;
        }
     }
  }

function lowerCaseInput(obj)
  {
   if (obj == null)
     { return; }

   switch (obj.tagName.toUpperCase())
     {
      case ("INPUT"):
        {
         obj.value = obj.value.toLowerCase();
         break;
        }
      case ("TEXTAREA"):
        {
         obj.innerText = obj.innerText.toLowerCase();
         break;
        }
     }
  }

function getById(elementId)
  { return (document.getElementById(elementId)); }

function getByName(elementName)
  { return (document.getElementsByName(elementName)); }

function newElement(tagName)
  { return (document.createElement(tagName)); }

function focus(element)
  {
   var el = element;

   if (typeof(element) == "string")
     {
      el = getById(element);

      if (el == null)
        { el = getByName(element).item(0); }
     }

   if (el != null)
     {
      el.focus();
      return (true);
     }

   return (false);
  }