
  var ns4=document.layers;
  var ie4=document.all;
  var ns6=document.getElementById&&!document.all;

  var dragswitch=0;
  var nsx;
  var nsy;
  var nstemp;

  function DragDropNS(name){
    if (!ns4)
      return;
    temp=eval(name);
    temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
    temp.onmousedown=GoNS;
    temp.onmousemove=DragNS;
    temp.onmouseup=StopNS;
  }

  function GoNS(e){
    temp.captureEvents(Event.MOUSEMOVE);
    nsx=e.x;
    nsy=e.y;
  }

  function DragNS(e){
    if (dragswitch==1){
      temp.moveBy(e.x-nsx,e.y-nsy)
      return false
    }
  }

  function StopNS(){
    temp.releaseEvents(Event.MOUSEMOVE)
  }

  function DragDropIE(e){
    if (ie4&&dragapproved){
      oCross.style.left=tempx+event.clientX-offsetx
      oCross.style.top=tempy+event.clientY-offsety
      return false
    }
    else if (ns6&&dragapproved){
      oCross.style.left=tempx+e.clientX-offsetx
      oCross.style.top=tempy+e.clientY-offsety
      return false
    }
  }

  function InitDrag(e){
    oCross=ns6? document.getElementById("showpopup") : document.all.showpopup;

    var oBar=ns6? e.target : event.srcElement
    var topelement=ns6? "HTML" : "BODY";

    while (oBar.tagName!=topelement&&oBar.id!="dragbar"){
      oBar=ns6? oBar.parentNode : oBar.parentElement;
    }

    if (oBar.id=="dragbar"){
      offsetx=ie4? event.clientX : e.clientX;
      offsety=ie4? event.clientY : e.clientY;

      tempx=parseInt(oCross.style.left)
      tempy=parseInt(oCross.style.top)

      dragapproved=true
      document.onmousemove=DragDropIE;
    }
  }
  document.onmousedown=InitDrag;
  document.onmouseup=new Function("dragapproved=false");

  function Drag_onMouseOver(){
  dragswitch=1;
  if (ns4) DragDropNS(showpopup)
  }
  function Drag_onMouseOut(){
  dragswitch=0;
  }

  function Drag_doHideBox(){
    if (ie4||ns6)
      oCross.style.visibility="hidden";
    else if (ns4)
      document.showpopup.visibility="hide";

 return false;
  }