    var map = null;
    var geocoder = null;
	var mainaccommodationicon;
	var accommodationicon;
	var TouristAttractionicon;
	var bounds;
	
    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(46.227638,2.213749), 12);
        geocoder = new GClientGeocoder();
        bounds = new GLatLngBounds(); 
        accommodationicon = new GIcon();
		accommodationicon.image = "http://www.ernalowproperty.co.uk/images/accommodation.png";
        loadpointsonmap();
      }
    }

	var map;
	var mainaccommodationicon;
	var accommodationicon;
	var airporticon;
	var regionicon;
	var resorticon;
	var TouristAttractionicon;
	var bounds;
	
	function loadGMap() {
		if (document.getElementById('map_canvas') != null) {		
			if (GBrowserIsCompatible()) {
				map = new GMap2(document.getElementById("map_canvas"),  {mapTypes:[G_NORMAL_MAP,G_HYBRID_MAP,G_SATELLITE_MAP,G_PHYSICAL_MAP]});
				bounds = new GLatLngBounds(); 
				map.addControl(new GLargeMapControl());
				map.addControl(new GMapTypeControl());
				map.addControl(new GOverviewMapControl());
				//map.addMapType(G_PHYSICAL_MAP); 
				map.setMapType(G_PHYSICAL_MAP);

				// Create the main accommodation icon
				mainaccommodationicon = new GIcon();
				mainaccommodationicon.image = "http://www.ernalowproperty.co.uk/images/accommodationmain.png";
				//mainaccommodationicon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
				mainaccommodationicon.iconSize = new GSize(30, 29);
				//mainaccommodationicon.shadowSize = new GSize(22, 20);
				mainaccommodationicon.iconAnchor = new GPoint(8, 8);
				mainaccommodationicon.infoWindowAnchor = new GPoint(5, 1);        

				// Create the main accommodation icon
				accommodationicon = new GIcon();
				accommodationicon.image = "http://www.ernalowproperty.co.uk/images/accommodation.png";
				//accommodationicon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
				accommodationicon.iconSize = new GSize(30, 29);
				//accommodationicon.shadowSize = new GSize(22, 20);
				accommodationicon.iconAnchor = new GPoint(8, 8);
				accommodationicon.infoWindowAnchor = new GPoint(5, 1);    
				
				// Create the main accommodation icon
				regionicon = new GIcon();
				regionicon.image = "/images/region.png";
				//accommodationicon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
				regionicon.iconSize = new GSize(30, 29);
				//accommodationicon.shadowSize = new GSize(22, 20);
				regionicon.iconAnchor = new GPoint(8, 8);
				regionicon.infoWindowAnchor = new GPoint(10, 0);   
				
				// Create the main accommodation icon
				resorticon = new GIcon();
				resorticon.image = "/images/bullet-resort.gif";
				//accommodationicon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
				resorticon.iconSize = new GSize(25, 25);
				//accommodationicon.shadowSize = new GSize(22, 20);
				resorticon.iconAnchor = new GPoint(8, 8);
				resorticon.infoWindowAnchor = new GPoint(5, 1);      
				
				// Create the main accommodation icon
				airporticon = new GIcon();
				airporticon.image = "/images/ernalow-plane-icon.png";
				//accommodationicon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
				airporticon.iconSize = new GSize(30, 30);
				//accommodationicon.shadowSize = new GSize(22, 20);
				airporticon.iconAnchor = new GPoint(8, 8);
				airporticon.infoWindowAnchor = new GPoint(5, 1);        



				loadpointsonmap();

				//document.getElementById("map").onmousewheel = function(){zoom(); return false;};

			}
		}	
	}
	

function zoom()
{
	var new_zoom = map.getZoom();
	if (event.wheelDelta >= 120)
		new_zoom++;
	else
		new_zoom--;

	map.setZoom(new_zoom);
}

function updatedirectionsurl(intposition) {
	var baseurl;
	var postcode;
	var directionsurl;
	
        baseurl = document.getElementById('hiddirectionsurl'+intposition).value;
	postcode = document.getElementById('txtdirectionsurl'+intposition).value;

	directionsurl = baseurl + '&saddr=' + postcode;
	
	window.open(directionsurl,'directionswindow','resizable=1,width=770,height=570');
		
}


    function showAddress(address) {
     //alert(geocoder);
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              document.getElementById("location").innerText =  point;
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }
    