/* DOCUMENT READY
----------------------------------------------------------- */
var geocoder;
var lokace;
var map;

function gMapInitialize(canvas) {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById(canvas), myOptions);
}

function gMapFindAddress(address) {
    if(!address && lokace){
        map.setCenter(lokace);
        map.setZoom(16);
        var marker = new google.maps.Marker({
            map: map,
            position: lokace
        });
        
    }
    else{
        geocoder.geocode( { 'address': address}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            lokace = results[0].geometry.location;
            map.setCenter(results[0].geometry.location);
            map.setZoom(16);
            var marker = new google.maps.Marker({
                map: map,
                position: results[0].geometry.location
            });
          } else {
            alert("Geocode was not successful for the following reason: " + status);
          }
        });
    }
}


$(function(){

 


                            

});





