function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else {
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}

function showPosition(position) {
    $("#latitude").val(position.coords.latitude);
    $("#longitude").val(position.coords.longitude);
}


$(document).ready(function () {
    $("#search-box").keyup(function () {
        $.ajax({
            type: "POST",
            url: "readEscuelas.php",
            data: 'keyword=' + $(this).val(),
            beforeSend: function () {
                $("#search-box").css("background", "#FFF url(images/LoaderIcon.gif) no-repeat 165px");
            },
            success: function (data) {
                $("#suggesstion-box").show();
                $("#suggesstion-box").html(data);
                $("#search-box").css("background", "#FFF");

            }
        });
    });
});

function selectCountry(val,clave,localidad) {
    $('#nombre_escuela').empty();
    $('#clave').empty();
    $('#titulo1').empty();
    $('#titulo2').empty();
    //$("#suggesstion-box").empty();

    $("#search-box").val(val);
    //
    $('#suggesstion-box').empty();
    $("#suggesstion-box").hide();
    $('#clave_escuela').val(clave);

    $('#nombre_escuela').append('' + $('#search-box').val());
    $('#titulo1').append('<h1><b>Escuela: </b></h1>');
    $('#titulo2').append('<h3><b>Localidad:</b></h3>');
    $('#clave').append(localidad);

    $('#next').attr("disabled", false);
}