isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

isIE2=document.all;
isNN2=!document.all&&document.getElementById;
isN42=document.layers;
isHot2=false;

function ddInit(e)
{
	  topDog=isIE ? "BODY" : "HTML";
	  whichDog=isIE ? document.all.Layer1 : document.getElementById("Layer1");
	  hotDog=isIE ? event.srcElement : e.target;

	  whichDog2=isIE2 ? document.all.Layer2 : document.getElementById("Layer2");
	  hotDog2=isIE2 ? event.srcElement : e.target;

		  while ((hotDog.id!="sdrage" && hotDog.tagName!=topDog)&&(hotDog2.id!="sdrage" && hotDog2.tagName!=topDog))
		  {
			hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
		  }
		  if (hotDog.id=="sdrage")
		  {
			offsetx=isIE ? event.clientX : e.clientX;
			offsety=isIE ? event.clientY : e.clientY;
			nowX=parseInt(whichDog.style.left);
			nowY=parseInt(whichDog.style.top);
			ddEnabled=true;

			document.getElementById("Layer1").onmousemove=dd;
			document.getElementById("Layer1").onmouseup = dd_cls;
		  }

		  while (hotDog2.id!="sdrage2"&&hotDog2.tagName!=topDog)
		  {
			hotDog2=isIE2 ? hotDog2.parentElement : hotDog2.parentNode;
		  }
		  if (hotDog2.id=="sdrage2")
		  {
			offsetx2=isIE2 ? event.clientX : e.clientX;
			offsety2=isIE2 ? event.clientY : e.clientY;
			nowX2=parseInt(whichDog2.style.left);
			nowY2=parseInt(whichDog2.style.top);
			ddEnabled2=true;

			document.getElementById("Layer2").onmousemove=dd2;
			document.getElementById("Layer2").onmouseup = dd_cls;
		  }

}

function dd(e)
{
	  if (!ddEnabled) return;
	  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
	  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
	  return false;
}

function dd2(e)
{
	  if (!ddEnabled2) return;
	  whichDog2.style.left=isIE2 ? nowX2+event.clientX-offsetx2 : nowX+e.clientX-offsetx2;
	  whichDog2.style.top=isIE2 ? nowY2+event.clientY-offsety2 : nowY+e.clientY-offsety2;
	  return false;
}

function dd_cls()
{
ddEnabled = false;
ddEnabled2 = false;
}

document.onmousedown=ddInit;