
  var NODE_TYPE_ELEMENT=1;
  html={
                getElementById: function(id) {
      if (id=='') return null;
      obj=document.getElementById(id);
      html.extend(obj);
      return obj;
    },

    createElement: function(tagname) {
      var obj=document.createElement(tagname);
      if (obj) html.extend(obj);
      return obj;
    },

                extend: function(obj) {
      if (!obj) return obj;
      if (obj.isExtended) return obj;
      if ((obj.nodeType!=NODE_TYPE_ELEMENT) || (typeof obj.isExtended!="undefined")) return obj;
      for (_method in html.Methods) obj[_method]=html.Methods[_method];
      obj.extendChildNodes();
      return obj;
    },

                Methods: {
      isExtended: true,

      extendChildNodes: function() {
        for (var i=0;i<this.childNodes.length;i++) {
          html.extend(this.childNodes[i]);
        }
      },

      hasClass: function(classname) {
        var classes=this.className.split(" ");
        for (var i=0;i<classes.length;i++) {
          if (classes[i]==classname) return true;
        }
        return false;
      },

      addClass: function(classname) {
        if (this.hasClass(classname)) return;
        if (this.className!='') this.className+=" ";
        this.className+=classname;
      },

      removeClass: function(classname) {
        var classes=this.className.split(" ");
        var result="";
        for (var i=0;i<classes.length;i++) {
          if (classes[i]!=classname) {
            if (result!="") result+=" ";
            result+=classes[i];
          }
        }
        this.className=result;
      },

      setOpacity: function(opacity) {
        if (!document.all) {
          this.style.opacity=opacity/100;
        } else {
          this.style.filter="Alpha(opacity="+opacity+")";
        }
        this.setDisplay(true);
      },

      setDisplay: function(isVisible) {
        this.style.display=(isVisible)?"":"none";
      },

      setVisibility: function(isVisible) {
        this.style.visibility=(isVisible)?"":"hidden";
      },

      getPageCoords: function() {
        var coords={x:0,y:0};
        var element=this;

        if (element.offsetParent) {

          while (element) {
            if (element.tagName=='BODY' || element.tagName=='HTML') break;
            coords.x+=element.offsetLeft-element.scrollLeft;
            coords.y+=element.offsetTop-element.scrollTop;
            element=element.offsetParent;
          }

        } else {
          if (element.x) coords.x+=element.x;
          if (element.y) coords.y+=element.y;
        }

                if(!window.opera && document.all && document.compatMode && document.compatMode!="BackCompat" && this.style.position!='absolute') {
          coords.x+=parseInt(document.body.currentStyle.marginLeft);
          coords.y+=parseInt(document.body.currentStyle.marginTop);
        }

        return coords;
      },

      centerOnScreen: function() {
        // put object out of screen and make it visible to be able to find out offsetHeight and offsetWidth
        this.style.position=(document.all)?"absolute":"fixed";
        this.style.top="-999999px";
        this.style.left="-999999px";
        this.setDisplay(true);

        var marginTop=this.offsetHeight/-2;
        var marginLeft=this.offsetWidth/-2;

        // the obligatory IE 6 workaround
        if (document.all) {
          var body=(document.documentElement)?document.documentElement:document.body;
          marginTop+=body.scrollTop;
          marginLeft+=body.scrollLeft;
        }

        // center on screen with CSS magic
        this.style.marginTop=marginTop+"px";
        this.style.marginLeft=marginLeft+"px";
        this.style.top="50%";
        this.style.left="50%";
      }
    }
  }
