function OnGridHeaderClick(a_strGridId, a_strId)
{
	document.getElementById(a_strGridId + "Sort").value = "true";
	document.getElementById(a_strGridId + "SortExpression").value = a_strId;
	Submit(a_strGridId, "HeaderClick");
}

function OnGridRowClick(a_strGridId, a_strId)
{
	var strRecentIndex = document.getElementById(a_strGridId + "RecentlySelectedRowId").value;
	var strRecentStyle = document.getElementById(a_strGridId + "RecentlySelectedRowCssStyle").value;
	
	if (strRecentIndex && document.getElementById(a_strGridId + "Row#" + strRecentIndex) != null)
	{
		document.getElementById(a_strGridId + "Row#" + strRecentIndex).className = strRecentStyle;
	}

	document.getElementById(a_strGridId + "RecentlySelectedRowId").value = a_strId;	
	document.getElementById(a_strGridId + "RecentlySelectedRowCssStyle").value = document.getElementById(a_strGridId + "Row#" + a_strId).className;

	document.getElementById(a_strGridId + "SelectedValue").value = a_strId;	
	document.getElementById(a_strGridId + "Row#" + a_strId).className = "GridRowSelected";
}

function OnGridMultipleRowClick(a_strGridId, a_strId)
{
	if (!arlGridSelectedValues.Contains(a_strId))
	{
		arlGridSelectedValues.Add(a_strId);
		document.getElementById(a_strGridId + "Row#" + a_strId).className = "GridRowSelected";
	}
	else
	{
		arlGridSelectedValues.Remove(a_strId);
		document.getElementById(a_strGridId + "Row#" + a_strId).className = "GridRow";	
	}

	document.getElementById(a_strGridId + "SelectedValues").value = arlGridSelectedValues.Serialize();
}

function OnGridPageClick(a_strGridId, a_nPage)
{
	document.getElementById(a_strGridId + "Page").value = a_nPage;
	Submit(a_strGridId, "PageClick");
}	