﻿function getLocation() {
    var geoLocator = function() {
        if (navigator.geolocation) {
            return navigator.geolocation;
        }
        if (google.gears) {
            return google.gears.factory.create('beta.geolocation');
        }
        return null;
    };

    var geo = geoLocator();
    if (geo != null) {
        /* geolocation is available */
        geo.getCurrentPosition(function(position) {
            var poss = position.coords.latitude + "," + position.coords.longitude;
            $("#poloha").text(poss);
            map.setCenter(new GLatLng(position.coords.latitude, position.coords.longitude), 14);

        });
    } else {
        $("#poloha").text("Vaši polohu nelze určit. Použijte Firefox 3.5 a vyšší.");
    }
}
