попроще и с jquery
var mouse_event = 0
var differenceX = 0
var differenceY = 0
$('#dialog_title').mousedown(function(e){
differenceX = e.pageX-parseInt($('#dialog').css('left'))
differenceY = e.pageY-parseInt($('#dialog').css('top'))
mouse_event=1
})
document.onmouseup = function(){
mouse_event = 0
}
document.onmousemove = function(e){
if (mouse_event == 1){
$('#dialog').css('left',e.pageX-differenceX)
$('#dialog').css('top',e.pageY-differenceY)
}
}
<div id="dialog">
<div id="dialog_title">Title<spa id="dialog_close" style="position:absolute;right:5px;top:3px;cursor: hand;"></span></div>
<div id="dialog_content"></div>
</div>