var GoogleMaps = Class.create({
	
	initialize: function()
	{
		var geocoder;
		var map;
		var latlng = new google.maps.LatLng(53.797, -1.573);
		var address = $('addressValue').getValue();
		
		geocoder = new google.maps.Geocoder();
    	
    	var myOptions = {
    		zoom: 14,
      		center: latlng,
      		mapTypeId: google.maps.MapTypeId.ROADMAP
    	}
    	
    	map = new google.maps.Map($("map_canvas"), myOptions);
    	
	    if (geocoder) 
	    {
	    	geocoder.geocode( { 'address': address}, function(results, status)
	    	{
		        if (status == google.maps.GeocoderStatus.OK)
		        {
		        	map.setCenter(results[0].geometry.location);
		        	var marker = new google.maps.Marker(
		        	{
		        		map: map, 
		        		position: results[0].geometry.location
		        	});
		        }
	    	});
	    }
	}
});

document.observe('dom:loaded', function() 
{
	if ($('addressValue'))
	{
		var googleMaps = new GoogleMaps();
	}
});
