//<![CDATA[
var map;
var icon;
var newpoints = new Array();

function loadBathMap() {
	// http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=BA1+1DG&sll=53.800651,-4.064941&sspn=14.149238,36.474609&ie=UTF8&ll=51.384544,-2.361567&spn=0.007285,0.01781&z=16&g=BA1+1DG&iwloc=addr
	load(51.384544,-2.361567,'Bath', '<div id="popup">Milsoms Hotel Bath<br />24 Milsom Street<br />Bath BA1 1DG</div>');
}

function loadHenleyMap() {
	// http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=RG9+2AH&sll=50.702805,-1.925075&sspn=0.007393,0.01781&g=RG9+2AH&ie=UTF8&ll=51.537661,-0.905879&spn=0.006954,0.01781&z=16&iwloc=addr
	load(51.537661,-0.905879,'Henley', '<div id="popup">Milsoms Hotel Henley<br />20 Market Place<br />Henley-on-Thames RG9 2AH </div>');
}

function loadKenilworthMap() {
	// http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=CV8+1LZ&sll=51.537661,-0.905879&sspn=0.006954,0.01781&g=CV8+1LZ&ie=UTF8&ll=52.349851,-1.583726&spn=0.006829,0.01781&z=16&iwloc=addr
	load(52.349851,-1.583726,'Kenilworth', '<div id="popup">Milsoms Hotel Kenilworth<br />The Clarendon House, High Street<br />Kenilworth, Warwickshire, CV8 1LZ</div>');
}

function loadPooleMap() {
	// http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=Poole,+Dorset+BH13+7LH&sll=53.800651,-4.064941&sspn=13.127023,32.519531&ie=UTF8&ll=50.701283,-1.925826&spn=0.006863,0.015879&z=16&g=Poole,+Dorset+BH13+7LH&iwloc=addr
	load(50.701283,-1.925826,'Poole', '<div id="popup">Milsoms Hotel Poole<br />47 Haven Road Canford Cliffs<br />Poole, Dorset BH13 7LH </div>');
}
function load(lat,long,title,html) {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		
		map.addControl(new GLargeMapControl());
		//map.addControl(new GMapTypeControl());
		
		map.setCenter(new GLatLng(lat,long), 16);
		 
		icon = new GIcon();
		icon.image = "http://www.google.com/mapfiles/marker.png";
		icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		icon.iconSize = new GSize(20, 34);
		icon.shadowSize = new GSize(37, 34);
		icon.iconAnchor = new GPoint(9, 34);
		icon.infoWindowAnchor = new GPoint(9, 2);
		icon.infoShadowAnchor = new GPoint(18, 25);
		
		addPoints(lat,long,title,html);
	}
}


function addPoints(lat,long,title,html) {
	newpoints[0] = new Array(lat,long, icon, title, html); 
	for(var i = 0; i < newpoints.length; i++) {
 
		var point = new GLatLng(newpoints[i][0], newpoints[i][1]);
 
		//Add overlay to map 
		var popuphtml = newpoints[i][4] ;
		var marker = createMarker(point,newpoints[i][2],popuphtml);
		map.addOverlay(marker);
	}
}

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

//]]>