function GetMapGrid() {

    xmlHttp = GetXmlHttpObject()
    if (xmlHttp == null) {
        alert("Your browser does not support AJAX!");
        return;
    }

    var url = "AjaxMapGrid.aspx?MapGrid=" + document.getElementById("txtMapGrid").value + "&num=" + Math.random();
    xmlHttp.onreadystatechange = RecieveMapGrid;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
    CloseMapGrid();
}
function RecieveMapGrid() {
    if (xmlHttp.readyState == 4) {
        Result = xmlHttp.responseText;
        if(Result == "")
        {
            alert("Error:Grid reference falls outside the AfriGIS 1:20000 grid");
        }
        else
        {
            _s = Result.split("|");
            document.getElementById("txtMapGrid").value = "";
            var oLatLng = new AGCoord(parseFloat(_s[0]),parseFloat(_s[1]));
            g_map.centreAndScale(oLatLng,15)
        }
      }
}
function CloseMapGrid() {
    document.getElementById("Mapgrid").style.display = 'none';
}
function showMapGrid() {
    CloseAllPopups();
    document.getElementById("Mapgrid").style.display = '';
    $("#txtMapGrid").focus();
}

