/***********************************************
* Drag and Drop Script: © 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, 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
    
    var ctrlPressed=0;
    var altPressed=0;
    var shiftPressed=0;
    
    var evt = navigator.appName=="Netscape" ? e:event;
    
    if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
     // NETSCAPE 4 CODE
     var mString =(e.modifiers+32).toString(2).substring(3,6);
     shiftPressed=(mString.charAt(0)=="1");
     ctrlPressed =(mString.charAt(1)=="1");
     altPressed  =(mString.charAt(2)=="1");
     self.status="modifiers="+e.modifiers+" ("+mString+")"
    }
    else {
     // NEWER BROWSERS [CROSS-PLATFORM]
     shiftPressed=evt.shiftKey;
     altPressed  =evt.altKey;
     ctrlPressed =evt.ctrlKey;
     self.status=""
      +  "shiftKey="+shiftPressed 
      +", altKey="  +altPressed 
      +", ctrlKey=" +ctrlPressed 
    }
    if (shiftPressed)
    {
      shiftDown = true;
    }
    else
    {
      shiftDown = false;
      
      this.targetobj=window.event? event.srcElement : e.target
      if (this.targetobj.className=="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)
        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"
      return false
    }
  }
}

dragobject.initialize()