var geocoder;
var map;
function initialize() 
{
	geocoder = new google.maps.Geocoder();
	var latlng = new google.maps.LatLng(0, 0);
	var myOptions = {
		zoom: 13,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		disableDefaultUI: true,
		navigationControl: true,
		mapTypeControl: true,
		scaleControl: true
    }
	map = new google.maps.Map(document.getElementById("googlemap"), myOptions);
}

function codeAddress(address, firma, text)
{
	if (geocoder) 
	{
		geocoder.geocode( {'address': address}, function(results, status) 
		{
			if (status == google.maps.GeocoderStatus.OK) 
			{
				if (status != google.maps.GeocoderStatus.ZERO_RESULTS) 
				{
//alert(results[0].geometry.location);
					map.setCenter(results[0].geometry.location);
var contentString = '<div id="bodycontent">'+'<b>'+firma+'</b><p>'+text+'</div>';

var infowindow = new google.maps.InfoWindow({
	maxWidth: 150,
    content: contentString
});
					var marker = new google.maps.Marker({
													map: map, 
													position: results[0].geometry.location,
													title:firma
					});
google.maps.event.addListener(marker, 'click', function() {
  infowindow.open(map,marker);
});
//					infowindow.open(map,marker);
				}
				else
				{
					//alert("No results found");
				}
			}
			else
			{
				//alert("Geocode was not successful for the following reason: " + status);
			}
		});
	}
}

