var system = 
{
  'get_object_position':function(obj)
  {  
    var oPosition = {x:0, y:0};
	  if (obj.offsetParent)
	  {
		  while (obj.offsetParent)
		  {                
			  oPosition.x += obj.offsetLeft;       
        oPosition.y += obj.offsetTop;       
			  obj = obj.offsetParent;
		  }
	  }    
	  else if (obj.x)
    {      
		  oPosition.x += obj.x;
      oPosition.y += obj.y;  
    }
    
    return oPosition;     
  },     
  
  'get_event_position':function(e)
  {
    var oPosition = {x:0, y:0}; 
    if (typeof(e) == 'undefined')
       e = window.event;
              
      if (typeof(e.pageX) != 'undefined')        
      {
        oPosition.x = e.pageX;
        oPosition.y = e.pageY;
      }
      else
      {
        oPosition.x = window.event.clientX + document.documentElement.scrollLeft  + document.body.scrollLeft;
        oPosition.y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;      
      }         
      
    return oPosition;
  },
  
  'get_event_target':function(e)
  {
    var target;
    if (typeof(e) == 'undefined')
      target = event.srcElement;              
    else
      target = e.target;
      
    return target;
  },
  
  'set_popup_position': function(oPopup)
  {
    var x,y;
    if (self.pageYOffset) // all except Explorer
    {
	    x = self.pageXOffset;
	    y = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop)
	    // Explorer 6 Strict
    {
	    x = document.documentElement.scrollLeft;
	    y = document.documentElement.scrollTop;
    }
    else if (document.body) // all other Explorers
    {
	    x = document.body.scrollLeft;
	    y = document.body.scrollTop;
    }

    oPopup.style.top  = y + 160 + 'px';
    oPopup.style.left = document.body.clientWidth/2 - 170 + 'px';        
  },
  
  'get_checked_nodes': function()
  {
    var oElements = document.getElementsByName('list_view_checkboxes');
    var i, aNodes = [];
    for (i = 0; i < oElements.length; i++)
    {
      if (oElements[i].checked)
        aNodes.push(oElements[i].id.substr(19, oElements[i].id.length));
    }
    
    return aNodes;
  },
  
  'get_document_size': function()
  {
    var x,y;
    if (self.innerHeight) // all except Explorer
    {
	    x = self.innerWidth;
	    y = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight)
	    // Explorer 6 Strict Mode
    {
	    x = document.documentElement.clientWidth;
	    y = document.documentElement.clientHeight;
    }
    else if (document.body) // other Explorers
    {
	    x = document.body.clientWidth;
	    y = document.body.clientHeight;
    }
    
    var xx,yy;
    var test1 = document.body.scrollHeight;
    var test2 = document.body.offsetHeight
    if (test1 > test2) // all but Explorer Mac
    {
	    xx = document.body.scrollWidth;
	    yy = document.body.scrollHeight;
    }
    else // Explorer Mac;
         //would also work in Explorer 6 Strict, Mozilla and Safari
    {
	    xx = document.body.offsetWidth;
	    yy = document.body.offsetHeight;
    }
    
    //alert(document.body.scrollHeight);
    //alert(document.body.offsetHeight);

    var oSize = {width:0, height:0};
    oSize.height = ((y > yy) ? y : yy);    
    oSize.width = xx;
    
    return oSize;
  }
};

