﻿function GetObjectById(argId)
{
	var tmpResult = null;
	if (document.layers)
	{
		tmpResult = document.layers[argId];
	}
	else if (document.all)
	{
		tmpResult = document.all[argId];
	}
	else if (document.getElementById)
	{
		tmpResult = document.getElementById(argId);
	}
	return tmpResult;
}

function GetMousePosition(e)
{
	if (!e)
	{
		e = window.event;
	}
	
	var cursor = { x: 0, y: 0 };
	if (e.pageX || e.pageY)
	{
		cursor.x = e.pageX;
		cursor.y = e.pageY;
	}
	else
	{
		var de = document.documentElement;
		var b = document.body;
		cursor.x = e.clientX +
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
		cursor.y = e.clientY +
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
	}
	return cursor;
}

function SetObjectPositionTop(argObject, argTop)
{
	if (document.getElementById)
	{
		argObject.style.top = argTop + "px";
	}
	else if (document.all)
	{
		argObject.style.top = argTop + "px";
	}
	else if (document.layers)
	{
		argObject.top = argTop;
	}
}

function SetObjectPositionLeft(argObject, argLeft)
{
	if (document.getElementById)
	{
		argObject.style.left = argLeft + "px";
	}
	else if (document.all)
	{
		argObject.style.left = argLeft + "px";
	}
	else if (document.layers)
	{
		argObject.left = argLeft;
	}
}
