function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
  marker.openInfoWindowHtml(html);
});

// The new marker "mouseover" listener        
GEvent.addListener(marker,"mouseover", function() {
      marker.openInfoWindowHtml(html);
    });        
    
    return marker;
  }


function initialize(section) {
  if (GBrowserIsCompatible()) {
	  var map = new GMap2(document.getElementById("map_canvas"));
	  switch(section)
	  {
		  case "cumbria":
				map.setCenter(new GLatLng(54.196994,-2.930603), 10);
				map.addOverlay(new GMarker(new GLatLng(54.196994,-2.930603)));
				map.setUIToDefault();
		  break;
		  case "cairn":
				map.setCenter(new GLatLng(53.997338,-1.547553), 10);
				map.addOverlay(new GMarker(new GLatLng(53.997338,-1.547553)));
				map.setUIToDefault();
			break;
		  case "ben-nevis":
				map.setCenter(new GLatLng(56.826549,-5.086861), 10);
				map.addOverlay(new GMarker(new GLatLng(56.826549,-5.086861)));
				map.setUIToDefault();
			break;
		  case "nethybridge":
				map.setCenter(new GLatLng(57.265832,-3.656045), 10);
				map.addOverlay(new GMarker(new GLatLng(57.265832,-3.656045)));
				map.setUIToDefault();
			break;
		  case "alexandra":
				map.setCenter(new GLatLng(56.818733,-5.108063), 10);
				map.addOverlay(new GMarker(new GLatLng(56.818733,-5.108063)));
				map.setUIToDefault();
			break;
		  case "royal":
				map.setCenter(new GLatLng(56.412395, -5.471409), 10);
				map.addOverlay(new GMarker(new GLatLng(56.412395, -5.471409)));
				map.setUIToDefault();
			break;
		  case "salutation":
				map.setCenter(new GLatLng(56.394813, -3.427488), 10);
				map.addOverlay(new GMarker(new GLatLng(56.394813, -3.427488)));
				map.setUIToDefault();
			break;
		  default:
			  map.setCenter(new GLatLng(56.072035,-3.55957), 6);
			// cumbria
		  var gm = createMarker(new GLatLng(54.193228,-2.909575), "<p><img style='float: right; margin-left: 5px;' src='/templates/common/images/home/cumbria_grand.jpg' /><strong>Cumbria Grand Hotel</strong></p><p><a href='/Cumbria+Grand+Hotel/Contact/' title='View Hotel Details'>View Hotel Details</a></p>");
			map.addOverlay(gm); 
			// cairn
			gm = createMarker(new GLatLng(53.997338,-1.547553), "<p><img style='float: right; margin-left: 5px;' src='/templates/common/images/home/cairn_hotel.jpg' /><strong>Cairn Hotel</strong></p><p><a href='/Cairn+Hotel/Contact/' title='View Hotel Details'>View Hotel Details</a></p>");
			map.addOverlay(gm);
			// ben-nevis
			/*gm = new GMarker(new GLatLng(56.821081,-5.100746));
			  gm.bindInfoWindowHtml("<p><strong>Ben Nevis Hotel</strong></p><p><a href='/Ben+Nevis+Hotel/Contact/' title='View Hotel Details'>View Hotel Details</a></p>");
			map.addOverlay(gm);*/
			// nethybridge
			gm = createMarker(new GLatLng(57.265832,-3.656045), "<p><img style='float: right; margin-left: 5px;' src='/templates/common/images/home/nethybridge_hotel.jpg' /><strong>Nethybridge Hotel</strong></p><p><a href='/Nethybridge+Hotel/Contact/' title='View Hotel Details'>View Hotel Details</a></p>");
			map.addOverlay(gm);
			// alexandra
			gm = createMarker(new GLatLng(56.818733,-5.108063), "<p><img style='float: right; margin-left: 5px;' src='/templates/common/images/home/alexandra_nevis.jpg' /><strong>Alexandra Hotel</strong></p><p><a href='/Alexandra+Hotel/Contact/' title='View Hotel Details'>View Hotel Details</a></p><p><strong>Ben Nevis Hotel</strong></p><p><a href='/Ben+Nevis+Hotel/Contact/' title='View Hotel Details'>View Hotel Details</a></p>");
			map.addOverlay(gm);
			// royal
			gm = createMarker(new GLatLng(56.412395, -5.471409), "<p><img style='float: right; margin-left: 5px;' src='/templates/common/images/home/royal_oban.jpg' /><strong>Royal Hotel</strong></p><p><a href='/Royal+Hotel/Contact/' title='View Hotel Details'>View Hotel Details</a></p>");
			map.addOverlay(gm);
			// salutation
			gm = createMarker(new GLatLng(56.394813, -3.427488), "<p><img style='float: right; margin-left: 5px;' src='/templates/common/images/home/salutation_hotel.jpg' /><strong>Salutation Hotel</strong></p><p><a href='/Salutation+Hotel/Contact/' title='View Hotel Details'>View Hotel Details</a></p>");
			map.addOverlay(gm);
			
			map.setUIToDefault();
	  }
  }
}
