/*
 * @description Initialize object dragging.
 * @param objEvent this is the default event handler.
 */
function initDrag()
{
	document.onmousedown = startDrag;
	document.onmouseup = stopDrag;
	var objDragCurrentId = '';
}
/*
 * @description Start moving an element.
 * @param objEvent this is the event handler.
 * @returns false if the element isn't drag-able.
 */
function startDrag(objEvent)
{
	// Determine event object.
	if (!objEvent)
	{
		var objEvent = window.event;
	}
	// Determine target element.
	var objTarget = objEvent.target ? objEvent.target : objEvent.srcElement;
	if (objTarget.className.indexOf('drag') == -1)
	{
		return;
	}
	// Set the object parent table's object and  id.
	objDragCurrent = objTarget.parentNode.parentNode.parentNode;
	objDragCurrentId = objDragCurrent.id;
	// Calculate event X,Y coordinates.
	intOffsetX = objEvent.clientX;
	intOffsetY = objEvent.clientY;
	// Calculate integer values for top and left properties.
	intDragCoordX = 0;
	intDragCoordY = 0;
	intDragCoordX = parseInt(objDragCurrent.style.left);
	intDragCoordY = parseInt(objDragCurrent.style.top);
	blnDrag = true;
	// Move element.
	document.onmousemove = dragElement;
}
/*
 * @description Continue dragging element.
 * @param objEvent this is the event handler.
 * @returns false.
 */
function dragElement(objEvent)
{
	if (!blnDrag || !objDragCurrentId)
	{
		return;
	}
	if (!objEvent)
	{
		var objEvent = window.event;
	}
	objDragCurrent = document.getElementById(objDragCurrentId);
	objDragCurrent.style.left = intDragCoordX + objEvent.clientX - intOffsetX + 'px';
	objDragCurrent.style.top = intDragCoordY + objEvent.clientY - intOffsetY + 'px';
	return false;
}
/*
 * @description Stop dragging.
 */
function stopDrag()
{
	blnDrag = false;
}