//<![CDATA[
function load() {

if (GBrowserIsCompatible()) {

// Marker icon/image array
var markerImage = [
"googlemaps/mapicons/brown_MarkerDefault.png",
"googlemaps/mapicons/green_MarkerDefault.png",
]

// Create icon object
var brownIcon = new GIcon();
brownIcon.image = markerImage[0];
brownIcon.iconSize = new GSize(20, 34);
brownIcon.iconAnchor = new GPoint(9, 34);
// End icon object


// Create icon object
var greenIcon = new GIcon();
greenIcon.image = markerImage[1]; //set markerIamge to match array position of specific coloured image
greenIcon.iconSize = new GSize(20, 34);
greenIcon.iconAnchor = new GPoint(9, 34);
// End icon object

// Create map object
var map = new GMap2(document.getElementById("map"));
var mapControl = new GMapTypeControl();map.addControl(mapControl);map.addControl(new GLargeMapControl());map.addControl(new GOverviewMapControl());
var center = new GLatLng(51.876814,-9.584795) // set map center coords here
map.setCenter(center, 14);
		
// Start of colorSwitch code
function createColorSwitchMarker(point,html){
	var marker1 = new GMarker(point);
	map.addOverlay(marker1);

	var marker2 = new GMarker(marker1.getPoint(),{clickable:false, icon:brownIcon});
	map.addOverlay(marker2); // visited
	marker2.hide();

	var marker3 = new GMarker(marker1.getPoint(),{clickable:false, icon:brownIcon});
	map.addOverlay(marker3); // hover
	marker3.hide();

	GEvent.addListener(marker1,'mouseover',function(){
	marker3.show();
	});
	GEvent.addListener(marker1,'mouseout',function(){
	marker3.hide();
	});
	GEvent.addListener(marker1,'click',function(){
	marker1.openInfoWindowHtml(html);
	marker2.show();
	marker3.show();
	});
	GEvent.addListener(map,'infowindowclose',function(){
	marker2.hide();
	marker3.hide();
	});
}
// End of colorSwitch code

// Create each map marker and window info
var point = new GLatLng(51.879000,-9.583500);
var html="<img src='images/foleys.png'" +
         "width='163' height='121'/> <br/>" +
         "Foley's Townhouse, Restaurant, Pub<br/>" +
		 "Kenmare, Kerry, Ireland ";
createColorSwitchMarker(point,html);
// End individual map marker

point = new GLatLng(51.882800,-9.591000);
html="<img src='images/ghomes.png'" +
         "width='163' height='121'/> <br/>" +
         "Self Catering Holiday Homes,<br/>" +
		 "Gortamullen, Kerry, Ireland ";
createColorSwitchMarker(point,html);

point = new GLatLng(51.862000,-9.6100000);
html="<img src='images/killalabay.jpg'" +
         "width='163' height='121'/> <br/>" +
         "Killaha Cove House ,<br/>" +
		 "Killaha East, Kerry, Ireland ";
createColorSwitchMarker(point,html);

//  Keeping the original map center

GEvent.addListener(map,'infowindowclose',function(){
map.panTo(center);
});

      }
    }
    //]]>
