
function KeyDownEnterHandler(button_id, e, is_datagrid_postback)
{
	var btn;
	if (!e) 
	e = window.event;
	// process only the Enter key
    if (e.keyCode == 13)
		{
			// cancel the default submit
			e.returnValue=false;
			e.cancel = true;
			// submit the form by programmatically clicking the specified button
			if (!is_datagrid_postback)
			{
				btn = document.getElementById(button_id);
				if (btn != null)
				{
					btn.click();
				}
			}
			else
			{
				__doPostBack(button_id,'');
			}
        }
}


function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
	{
		while(1) 
		{
	        curleft += obj.offsetLeft;
		    if(!obj.offsetParent)
			break;
			obj = obj.offsetParent;
		}
	}
	else if(obj.x)
	{
		curleft += obj.x;
	}
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
	{
		while(1)
	    {
			curtop += obj.offsetTop;
			if(!obj.offsetParent)
			break;
			obj = obj.offsetParent;
		}
	}
	else if(obj.y)
	{
		curtop += obj.y;
	}
	return curtop;
}
