$(document).ready(function (){
	function addAddressToMap(response)
	{
		if(!response || response.Status.code != 200)
		{
			
		}
		else
		{
			document.place = response.Placemark[0];
			point = new GLatLng(document.place.Point.coordinates[1], document.place.Point.coordinates[0]);
			marker = new GMarker(point);
			map.addOverlay(marker);
			map.setCenter(new GLatLng(document.place.Point.coordinates[1], document.place.Point.coordinates[0]), 14);
		}
	}
	var map = null;
	var geocoder = null;
	
	map = new GMap2(document.getElementById("googlemapitem"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	
	if (typeof coords != "undefined")
	{
		point = new GLatLng(coords.lattitude, coords.longitude);
		marker = new GMarker(point);
		map.addOverlay(marker);
		map.setCenter(new GLatLng(coords.lattitude, coords.longitude), 14);
	}
	else if (typeof address != "undefined")
	{
		geocoder = new GClientGeocoder();
		var address1 = address+"HU";
		geocoder.getLocations(address1, addAddressToMap);
	}
	
});
