/***********************************************
* Drag and Drop Script: (c) Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var dragobject={
z: 0, x: 0, y: 0, id: null, offsetx : null, offsety : null, targetobj : null, dragapproved : 0,
initialize:function(){
document.onmousedown=this.drag
document.onmouseup=function(){this.dragapproved=0}
},
drag:function(e){
var evtobj=window.event? window.event : e
this.targetobj=window.event? event.srcElement : e.target
if (this.targetobj.className=="drag"){
this.dragapproved=1
this.id = this.targetobj.id; 
if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left='0px'}
if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top='0px'}
this.offsetx=parseInt(this.targetobj.style.left)
this.offsety=parseInt(this.targetobj.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
if (this.dragapproved==1){
this.targetobj.style.left=this.offsetx+evtobj.clientX-this.x+"px"
this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px"
if (document.getElementById(this.id+'bg')) {
	document.getElementById(this.id+'bg').style.left=this.offsetx+evtobj.clientX-this.x+1+"px";
	document.getElementById(this.id+'bg').style.top=this.offsety+evtobj.clientY-this.y+37+"px";
}
if (document.getElementById(this.id.substring(0,5))) {
	document.getElementById(this.id.substring(0,5)).style.left=this.offsetx+evtobj.clientX-this.x-1+"px";
	document.getElementById(this.id.substring(0,5)).style.top=this.offsety+evtobj.clientY-this.y-37+"px";
}
return false
}
}
}

dragobject.initialize()