var dragobject={
	z: 0, x: 0, y: 0, targetobj : null, dragapproved : 0,
	initialize:function(){
		document.onmousedown=this.drag;
		document.onmouseup=function(){
			this.dragapproved=0
			document.onmousemove=(document.all ? displaycoordIE : displaycoordNS);
		};
	},
	drag:function(e){
		var evtobj=window.event? window.event : e;
		var pop_into_obj=document.getElementById('pop_into');
		this.targetobj=window.event? event.srcElement : e.target;
		if (this.targetobj.className.substring(0,4)=="drag"){
			this.dragapproved=1
			if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left=0}
			if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top=0}
			this.offsetx=parseInt(this.targetobj.style.left)
			if(this.targetobj!=pop_into_obj){
				this.offsetx+=parseInt(pop_into_obj.style.left);
			}
			this.offsety=parseInt(this.targetobj.style.top)
			if(this.targetobj!=pop_into_obj){
				this.offsety+=parseInt(pop_into_obj.style.top);
			}
			this.x=evtobj.clientX
			this.y=evtobj.clientY
			if (evtobj.preventDefault){
				evtobj.preventDefault();
			}
			document.onmousemove=dragobject.moveit;
		}
	},
	moveit:function(e){
		var evtobj=window.event? window.event : e;
		var pop_into_obj=document.getElementById('pop_into');
		if (this.dragapproved==1){
			pop_into_obj.style.left=(this.offsetx+evtobj.clientX-this.x)+"px";
			pop_into_obj.style.top=(this.offsety+evtobj.clientY-this.y)+"px";
			return false;
		}
	}
}

dragobject.initialize();


