Ya logre lo que queria y funciona a la perfeccion, aqui les dejo el codigo y gracias a todos =D
Código HTML:
Ver original<script language="JavaScript1.2"> var ie=document.all;
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var x,y;
var dobj;
function movemouse(e){
if (isdrag){
dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
return false;}
}
function selectmouse(e){
var fobj = nn6 ? e.target : event.srcElement;
var topelement = nn6 ? "HTML" : "BODY";
var fobjClass = /\bdrag\b/.test(fobj.className);
while (fobj.tagName != topelement && fobj.className == fobjClass){
fobj = nn6 ? fobj.parentNode : fobj.parentElement;
}
fobj.style.position = 'relative';
if (fobjClass){
isdrag = true;
dobj = fobj;
tx = parseInt(dobj.style.left+0);
ty = parseInt(dobj.style.top+0);
x = nn6 ? e.clientX : event.clientX;
y = nn6 ? e.clientY : event.clientY;
document.onmousemove=movemouse;
return false;}
}
document.onmousedown=selectmouse;
document.onmouseup=new Function("isdrag=false");
<div style="width:100px;height:100px;background:#ABABAB;" class="drag cajas"> <div style="position:absolute;width:80px;height:80px;background:#BCBCBC;" class="drag"> <div style="position:absolute;width:60px;height:60px;background:#CDCDCD;" class="drag"> <div style="position:absolute;width:40px;height:40px;background:#DEDEDE;" class="drag"> <div style="position:absolute;width:20px;height:20px;background:#EFEFEF;" class="drag">