html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
#main div{position:absolute;width:220px;height:150px;border:1px solid #999;}
var a;
document.οnmοuseup=function(){
if(!a)return;
document.all?a.releaseCapture():window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
a="";
};
document.οnmοusemοve=function (d){
if(!a) return;
if(!d) d=event;
a.style.left=(d.clientX-b)+"px";a.style.top=(d.clientY-c)+"px";
};
function move(o,e){
a=o;
document.all?a.setCapture():window.captureEvents(Event.MOUSEMOVE);
b=e.clientX-parseInt(a.style.left);
c=e.clientY-parseInt(a.style.top);
o.style.zIndex=getMaxIndex()+1;
}
function $(id){return document.getElementById(id);}
function getMaxIndex(){
var index=0;
var ds=$('main').getElementsByTagName('div');
var l=$('main').getElementsByTagName('div').length;
for (i=0;i
{
if (ds[i].style.zIndex>index) index=ds[i].style.zIndex;
}
return index;
}