function begin(drag){
var x=event.clientX-parseInt(drag.style.left);
var y=event.clientY-parseInt(drag.style.top);
document.attachEvent("onmousemove",move);
document.attachEvent("onmouseup",getup)
function move(e){
drag.style.left=(event.clientX-x)+"px";
drag.style.top=(event.clientY-y)+"px";
}
function getup(e){
document.detachEvent("onmouseup",getup);
document.detachEvent("onmousemove",move);
}
}