//<![CDATA[


if (GBrowserIsCompatible()) {
  var gmarkers = [];
  var htmls = [];
  var i = 0;


	var mP = {
	
	
		init: function() {
			if(!document.getElementById('map')) {
				return;
			}					
			
			//map centre
			var lat = "55.65062";
			var lng = "-1.97694";
			
			var clat = "55.72011";
			var clng = "-1.92611";
			var newhtml = "28 Main Street<br />Lowick<br />Berwick upon Tweed<br />Northumberland.  (U.K.)<br />TD15 2UA";					
		
	     // create the map
	     mP.map = new GMap2(document.getElementById("map"));
	     mP.map.addControl(new GSmallMapControl());
	     mP.map.addControl(new GMapTypeControl());
	     mP.map.setCenter(new GLatLng(clat,clng), 11);
	
	     // obtain the attribues of each marker
	      var point = new GLatLng(lat,lng);
	      var html = newhtml;
	      var label = "Marker One";
	      // create the marker
	      var marker = mP.createMarker(point,label,html);
	      mP.map.addOverlay(marker);
		
		},
	
	
	
			// A function to create the marker and set up the event window
	    createMarker: function(point,name,html) {
	      var marker = new GMarker(point);
	
	      GEvent.addListener(marker, "click", function() {
	        marker.openInfoWindowHtml(html);
	      });
	
	      gmarkers[i] = marker;
	      htmls[i] = html;
	
	      i++;
	      return marker;
	    },
	
	
	    // This function picks up the click and opens the corresponding info window
	    myclick: function(i) {
	      gmarkers[i].openInfoWindowHtml(htmls[i]);
	    },
	    
	  
	    addEvent: function(elm, evType, fn, useCapture) {
			// for W3C DOM complience
	   	if (elm.addEventListener) {
	      elm.addEventListener(evType, fn, useCapture);
	      return true;
	    } 
			// for IE...
			else if (elm.attachEvent) {
	      var r = elm.attachEvent('on' + evType, fn);
	      //EventCache.add(elm, evType, fn);
	      return r;
	    } else {
			// for anyone else not IE or Moz... Safari etc	
	      elm['on' + evType] = fn;
	    }
	  }
	    
   
    
  }
 
 
	mP.addEvent(window, 'load', mP.init, false);
	mP.addEvent(window, 'unload', GUnload, false);
 
} else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}

 //]]>
