function $(obj){return document.getElementById(obj);}
function createHttpRequest()
{
	var httprequest;
	try
	{
		httprequest = new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			httprequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				httprequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				alert("your brower is not support 'XMLHttpRequest'!");
				return false;
			}
		}
	}
	return httprequest;
}

function Drag(p_id)
{
	this.Initialize(p_id)
}

Drag.prototype.Initialize=function(p_id)
{
	draged=false;
	
	$(p_id).attachEvent("onmousedown",this.dragStart);
	document.onmousemove=this.dragIng;
	document.onmouseup=this.dragEnd;
}
Drag.prototype.dragStart=function()
{
	draged=true;
	document.onselectstart=new Function("event.returnValue=false;");
	
	objDrag=event.srcElement;
	objDrag=objDrag.parentNode;
		

	lastX=Drag.getInfo(objDrag).left;
	lastY=Drag.getInfo(objDrag).top;
	x=event.clientX;
	y=event.clientY;
		
}

Drag.prototype.dragIng=function()
{
	if(draged)
	{
		objDrag.style.left=parseInt(lastX)+event.clientX-x;
		objDrag.style.top=parseInt(lastY)+event.clientY-y;
	}
}

Drag.prototype.dragEnd=function()
{
	draged=false;
	document.onselectstart=new Function("event.returnValue=true;");
	
}
Drag.prototype.getInfo=function(oO)
{
	var oN=new Object();
	oN.left=oN.top=oN.right=oN.bottom=0;
	oN.offsetWidth=oO.offsetWidth;
	oN.offsetHeight=oO.offsetHeight;
	while(oO)
	{
		oN.left+=oO.offsetLeft;
		oN.top+=oO.offsetTop;
		oO=oO.offsetParent;
	}
	oN.right=oN.left+oN.offsetWidth;
	oN.bottom=oN.top+oN.offsetHeight;
	return oN;
}

