Drag 'n' Drop: JavaScript

function doDrag(e) { 
  dump("dragging\n"); 
  var difX = e.clientX-window.lastX; 
  var difY = e.clientY-window.lastY; 
  var newX = parseInt(document.getElementById
     ("myElement").style.left)+difX+"px"; 
  var newY = parseInt(document.getElementById
     ("myElement").style.top)+difY+"px"; 
  document.getElementById
     ("myElement").style.left=newX; 
  document.getElementById
     ("myElement").style.top=newY; 
  window.lastX = e.clientX; 
  window.lastY = e.clientY; 
  dump("dragging comp\n"); 
}