    function loadModule(src)
    {
      var script = document.createElement('script');
      script.setAttribute('type', 'text/javascript'); 
      if (src.indexOf('?') == -1)
        script.setAttribute('src', src + '?rnd=' + Math.random());
      else
        script.setAttribute('src', src + '&rnd=' + Math.random());

      document.getElementsByTagName('head')[0].appendChild(script);
    }
    
    loadModule('http://www.waetech.com/js/whitespace.js');

      var dragSortTables = new Array();
      
      function DragSortTable(id, preserveAttribs, callbackFunction)
      {
        _this = this;
        this.preserveAttribs = preserveAttribs;
        this.rowDragging = null;
        this.rowOriginalBGColor = null;
        this.callbackFunction = callbackFunction;
        this.table = document.getElementById(id).getElementsByTagName('tbody')[0];
        this.table.onselectstart = function(e) {
          if (!e) var e = window.event;
          if (e.preventDefault) e.preventDefault();
          e.returnValue = false;
          return false;
        }
        this.table.onmouseout = function(e) {
          // if we are not dragging, exit
          if (!_this.rowDragging) return;
          if (!e) var e = window.event;
          if (e.preventDefault) e.preventDefault();
          e.returnValue = false;

          // if they've left the table, cancel the drag.
          if (!_this.ancestorOf(_this.table, e.relatedTarget || e.toElement))
            _this.stopDrag();
            
          return false;
        }
        this.table.onmousedown = function(e) {
          if (!e) var e = window.event;
          if (e.preventDefault) e.preventDefault();
          e.returnValue = false;
          var tr = _this.findTR(e.target || e.srcElement);
          if (tr)
            _this.startDrag(tr);   
          _this.rowOriginalBGColor = tr.style.backgroundColor;
          tr.style.backgroundColor = '#FFFF00';     
  
          return false;
        }
        this.table.onmouseup = function(e) {
          if (!e) var e = window.event;
          if (e.preventDefault) e.preventDefault();
          e.returnValue = false;
          var tr = _this.findTR(e.target || e.srcElement);

          if (tr)
            _this.stopDrag(tr);   
                         
          return false;
        }
        
        this.table.onmouseover = function(e) {
          if (!_this.rowDragging) return;
          if (!e) var e = window.event;
          if (e.preventDefault) e.preventDefault();
          e.returnValue = false;
          var tr = _this.findTR(e.target || e.srcElement);
          if ((tr != _this.rowDragging) && tr)
          {
            // check that we are only dragging one row away!
            if ((node_after(tr) == _this.rowDragging) || (node_after(_this.rowDragging) == tr))
            {

              _this.rowDragging.style.backgroundColor = _this.rowOriginalBGColor;     
  
              if (tr.offsetTop > _this.rowDragging.offsetTop)
                _this.moveTRAfter(tr);
              else
                _this.moveTRBefore(tr);
                
              _this.swapAttribs(tr, _this.rowDragging);
              _this.rowOriginalBGColor = _this.rowDragging.style.backgroundColor;
              _this.rowDragging.style.backgroundColor = '#FFFF00';
              
              if (typeof _this.callbackFunction == 'function')
              _this.callbackFunction(tr, _this.rowDragging);     
            }
          }
          return false;
        
        }
        
      }
      
      DragSortTable.prototype.findTR = function (element)
      {
        while (element && (element.tagName != 'TR'))
          element = element.parentNode;
        
        return element;
      }
      
      DragSortTable.prototype.moveTRBefore = function (tr)
      {
        try {
          tr.parentNode.removeChild(this.rowDragging);
          tr.parentNode.insertBefore(this.rowDragging, tr);
        }
        catch(e) {}
        return false;
      }
      
      DragSortTable.prototype.moveTRAfter = function (tr)
      {
        tr.parentNode.removeChild(this.rowDragging);
        this.insertAfter(this.rowDragging, tr);
        return false;
      }

      DragSortTable.prototype.startDrag = function (tr)
      {
        this.rowDragging = tr;
        tr.style.cursor = 'move';  
      }
      
      DragSortTable.prototype.stopDrag = function (tr)
      {
        if (!this.rowDragging) return;
        this.rowDragging.style.backgroundColor = _this.rowOriginalBGColor;
        this.rowDragging = null;

        if (typeof tr != 'undefined') 
          tr.style.cursor = '';  
      }
      
      DragSortTable.prototype.swapAttribs = function (el1, el2)
      {
        for (var i = 0; i < this.preserveAttribs.length; i++)
        {
          if (this.preserveAttribs[i] == 'background-color')
          {
            var t = el1.style.backgroundColor;
            el1.style.backgroundColor = el2.style.backgroundColor;
            el2.style.backgroundColor = t;
          }
          if (this.preserveAttribs[i] == 'class')
          {
            var t_1 = el1.className;
            var t_2 = el1.getAttribute('class');
            el1.className = el2.className;
            el1.setAttribute('class', el2.getAttribute('class'));
            el2.className = t_1;
            el2.setAttribute('class', t_2);
          }
        }
      }
      
      function initDragSortTable(id, preserveAttribs, callbackFunction)
      {
        dragSortTables[dragSortTables.length] = new DragSortTable(id, preserveAttribs, callbackFunction);
      }
      
      DragSortTable.prototype.insertAfter = function(newNode, refNode)
      {
      	if(refNode.nextSibling) {
      		return refNode.parentNode.insertBefore(newNode, refNode.nextSibling);
      	} else {
      		return refNode.parentNode.appendChild(newNode);
      	}
      }
      
      DragSortTable.prototype.ancestorOf = function(parent, refNode) {
        while(refNode && (refNode != parent))
          refNode = refNode.parentNode;
        return refNode == parent;

      }
