//function netDivObject(objDiv)
function netDivObject(htmlDiv, netDoc)
{
//  objDiv.$ = this;

  var self = this;
  this.classType = "netDivObject";
//  this.prototype = Node;

  var div = htmlDiv;
  var parentDoc = netDoc;

  this.appendHtmlChild = function(htmlElem) 
    {
      div.appendChild(htmlElem);
    };
    
  this.setInnerHTML = function(html)
    {
      div.setInnerHTML(html);
    };

  this.getInnerHTML = function()
    {
      return div.InnerHTML;
    };

  this.getHrefText = function()
    {
      return div.childNodes.item(0).childNodes.item(0).nodeValue;
    };

  this.getId = function()
    {
      if (div.Id == null) return div.id;
  
      return div.Id;
    };

  function getParentLeft()
    {
      if (div == null) return 0;
      
      if (div.parentNode == null) return 0;
      
      if (div.parentNode.style.posLeft) return div.parentNode.style.posLeft;
      if (!div.parentNode.style.left) return 0;
      return parseInt(div.parentNode.style.left);
    };

  function getParentTop()
    {
      if (div == null) return 0;
      
      if (div.parentNode == null) return 0;
      
      if (div.parentNode.style.posTop) return div.parentNode.style.posTop;
      if (!div.parentNode.style.top) return 0;
      return parseInt(div.parentNode.style.top);
    };

  this.setLeft = function(newLeft)
    {
      if (div.style.posLeft) div.style.posLeft = newLeft;
      else div.style.left = newLeft+"px";
    };

  this.setTop = function(newTop)
    {
      if (div.style.posTop) div.style.posTop = newTop;
      else div.style.top = newTop+"px";
    };
    
  this.setWidth = function(newWidth)
    {
      if (div.style.posWidth) div.style.posWidth = newWidth;
      else div.style.width = newWidth+"px";
    };

  this.setHeight = function(newHeight)
    {
      if (div.style.posHeight) div.style.posHeight = newHeight;
      else div.style.height = newHeight+"px";
    };

  this.setLeftC = function(newLeft)
    {
      this.setLeft(newLeft - getParentLeft());
    };

  this.setTopC = function(newTop)
    {
      this.setTop(newTop - getParentTop());
    };

  this.getLeft = function()
    {
      if (div.style.posLeft) return div.style.posLeft;
      return parseInt(div.style.left);
    };

  this.getTop = function()
    {
      if (div.style.posTop) return div.style.posTop;
      return parseInt(div.style.top);
    };

  this.getWidth = function()
    {
      if (div.style.posWidth) return div.style.posWidth;
      return parseInt(div.style.width);
    };

  this.getHeight = function()
    {
      if (div.style.posHeight) return div.style.posHeight;
      return parseInt(div.style.height);
    };

  this.getRight = function()
    {
      return this.getLeft() + this.getWidth();
    };

  this.getBottom = function()
    {
      return this.getTop() + this.getHeight();
    };

  this.getLeftC = function()
    {
      return this.getLeft() + getParentLeft();
    };

  this.getTopC = function()
    {
      return this.getTop() + getParentTop();
    };

  this.getRightC = function()
    {
      return this.getRight() + getParentLeft();
    };

  this.getBottomC = function()
    {
      return this.getBottom() + getParentTop();
    };

  this.highlight = function(switchOn)
    {
      var cl = div.className;
      
      if (switchOn) {
        if (cl.search(/\shighlight/,"") == -1) {
          var classes = cl.split(" ");
          classes.push("highlight");
          cl = classes.join(" ");
          }
        }
      else {
        cl = cl.replace(/\shighlight/,"");
        }
      div.className = cl;
    };

  this.movetofront = function(switchOn)
    {
      var cl = div.className;
      
      if (switchOn) {
        if (cl.search(/\smovetofront/,"") == -1) {
          var classes = cl.split(" ");
          classes.push("movetofront");
          cl = classes.join(" ");
          }
        }
      else {
        cl = cl.replace(/\smovetofront/,"");
        }
      div.className = cl;
    };

//  return objDiv;
}

