
	var zInd=0;
	var ox=oy=0;
	var nowDragObj;
	var runable=(!document.getElementById)? (!document.all)? (!document.layers)? -1:1:2:3;
	var ie=(document.all)? true:false;
	
	function getElm(name,style)
	{
		if (runable<1) return;
		var obj;
		if (runable==2) obj=document.all(name);
		else obj=document.getElementById(name);
		if (style && runable>1) obj=obj.style;
		return obj;
	}
	function dragStart(obj,e)
	{//ドラッグ開始
		
		if (ie) e=event;
		
		//現在ドラッグ中の場合は処理中止
		if (nowDragObj) return;
		
		nowDragObj=obj;
		ox=gmx(e);
		oy=gmy(e);
		if (runable>1 && document.body) document.body.style.cursor="move";
		
		//イベント設定
		
		document.onmousemove=dragMove;
		
		document.onmouseup=dragEnd;
		nowDragObj.style.zIndex=zInd+=1;
	}

	function dragMove(e)
	{//ドラッグで動かす
		if (!nowDragObj) return;
		if (ie) e=event;
		var nx=gmx(e);
		var ny=gmy(e);
		nowDragObj.style.left=nowDragObj.offsetLeft+(nx-ox);
		nowDragObj.style.top=nowDragObj.offsetTop+(ny-oy);
		ox=nx;
		oy=ny;
		window.status = nowDragObj.style.left+ " x " + nowDragObj.style.top;
		return true;
	}
	function mOver() {
		document.body.style.cursor="move";
	}
	function mOut() {
		document.body.style.cursor="auto";
	}
	function dragEnd()
	{//ドラッグ終了
		if (!nowDragObj) return;
		ox=oy=0;
		nowDragObj=null;
		if (runable>1 && document.body) document.body.style.cursor="auto";
		
		//イベント解除
		document.onmousemove=null;
		document.onmouseup=null;
	}
	function gmx(e)
	{//マウス位置取得X
		if (!e) return false;
		return (ie)? document.body.scrollLeft+event.clientX:e.pageX;
	}
	function gmy(e)
	{//マウス位置取得Y
		if (!e) return false;
		return (ie)? document.body.scrollTop+event.clientY:e.pageY;
	}

