  window.onerror = null;
  var undefined;

  // ----------------------------------------------------------------------

  function getParentNodeByName(obj, tag) {
    if (!obj.parentNode) { return false; }

    if (obj.parentNode.nodeName.toLowerCase() == tag.toLowerCase()) {
      return obj.parentNode;
    }

    return getParentNodeByName(obj.parentNode, tag);
  }

  // ----------------------------------------------------------------------

  function getPrevSiblingNodeByName(obj, tag) {
    if (!obj.previousSibling) { return false; }

    if (obj.previousSibling.nodeName.toLowerCase() == tag.toLowerCase()) {
      return obj.previousSibling;
    }

    return getPrevSiblingNodeByName(obj.previousSibling, tag);
  }

  // ----------------------------------------------------------------------

  function getNextSiblingNodeByName(obj, tag) {
    if (!obj.nextSibling) { return false; }

    if (obj.nextSibling.nodeName.toLowerCase() == tag.toLowerCase()) {
      return obj.nextSibling;
    }

    return getNextSiblingNodeByName(obj.nextSibling, tag);
  }

  // ----------------------------------------------------------------------

  function fireClickEvent(nodeId) {
    if (typeof event == 'object') {
      if (event.button == 2 || event.button == 3) {
        return;
      }
    }

    if (document.getElementById) {
      if (obj = document.getElementById(nodeId)) {
        obj.click();
      }
    }
  }

  // ----------------------------------------------------------------------

  function fireClickEventOnChild(obj, tag) {
    if (typeof event == 'object') {
      if (event.button == 2 || event.button == 3) {
        return;
      }
    }

    if (obj.hasChildNodes) {
      for (i=0; i<obj.childNodes.length; i++) {
        if (obj.childNodes[i].nodeName.toLowerCase() == tag.toLowerCase()) {

          if (obj.childNodes[i].click) {
            obj.childNodes[i].click();
            break;
          }

        }
      }
    }
  }

  // ----------------------------------------------------------------------

  function mover(obj, color) {
    if (color == undefined) {
      obj.style.backgroundColor = '#F6F6F6';
    } else {
      obj.style.backgroundColor = color;
    }
  }

  // ----------------------------------------------------------------------

  function mout(obj, color) {
    if (color == undefined) {
      obj.style.backgroundColor = '#DFDFDF';
    } else {
      obj.style.backgroundColor = color;
    }
  }

  // ----------------------------------------------------------------------

  function moverOnParentName(obj, tag, color) {
    newObj = getParentNodeByName(obj, tag);
    if (!newObj) { return; }

    if (color == undefined) {
      mover(newObj);
    } else {
      mover(newObj, color);
    }
  }

  // ----------------------------------------------------------------------

  function moutOnParentName(obj, tag, color) {
    newObj = getParentNodeByName(obj, tag);
    if (!newObj) { return; }

    if (color == undefined) {
      mout(newObj);
    } else {
      mout(newObj, color);
    }
  }

  // ----------------------------------------------------------------------

  function moverOnPrevSiblingName(obj, tag, color) {
    newObj = getPrevSiblingNodeByName(obj, tag);
    if (!newObj) { return; }

    if (color == undefined) {
      mover(newObj);
    } else {
      mover(newObj, color);
    }
  }

  // ----------------------------------------------------------------------

  function moutOnPrevSiblingName(obj, tag, color) {
    newObj = getPrevSiblingNodeByName(obj, tag);
    if (!newObj) { return; }

    if (color == undefined) {
      mout(newObj);
    } else {
      mout(newObj, color);
    }
  }

  // ----------------------------------------------------------------------

  function moverOnNextSiblingName(obj, tag, color) {
    newObj = getNextSiblingNodeByName(obj, tag);
    if (!newObj) { return; }

    if (color == undefined) {
      mover(newObj);
    } else {
      mover(newObj, color);
    }
  }

  // ----------------------------------------------------------------------

  function moutOnNextSiblingName(obj, tag, color) {
    newObj = getNextSiblingNodeByName(obj, tag);
    if (!newObj) { return; }

    if (color == undefined) {
      mout(newObj);
    } else {
      mout(newObj, color);
    }
  }

  // ----------------------------------------------------------------------

  function getCssClassByName(className) {
      var sheets = document.styleSheets;

      for (var i=0; i<sheets.length; i++) {

          // IE
          if (sheets[i].rules) {
              for (var j=0; j<sheets[i].rules.length; j++) {
                  if (sheets[i].rules[j].selectorText == '.' + className) {
                      return sheets[i].rules[j];
                  }
              }
          }

          // Gecko
          if (sheets[i].cssRules) {
              for (var j=0; j<sheets[i].cssRules.length; j++) {
                  if (sheets[i].cssRules[j].selectorText == '.' + className) {
                      return sheets[i].cssRules[j];
                  }
              }
          }

          return null;
      }
  }

  // ----------------------------------------------------------------------

  function setClassStyle(className, styleName, styleVal) {
      classObj = getCssClassByName(className);

      if (classObj) {
          eval('classObj.style.' + styleName + ' = "' + styleVal + '";');
      }
  }

function cl(inp, val) {
	if (inp.value == val) inp.value = "";
}

function fl(inp, val) {
	if (inp.value == "") inp.value = val;
}
