function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
function mapstyles(id,height,width,border){
   if (document.getElementById) {
      var mapstyles = document.getElementById(id);
      mapstyles.style.height = height;
      mapstyles.style.width = width;
      mapstyles.style.border = border;
   }
}
function loadmap() {
	if (GBrowserIsCompatible()) {
		mapstyles('map','286px','286px','1px solid #ccc');

		var icon = new GIcon();
		icon.image = "../i/small_house.png";
		icon.iconSize = new GSize(26,26);
		icon.iconAnchor = new GPoint(13,26);
		icon.infoWindowAnchor = new GPoint(13,13);
		icon.transparent="../i/small_house_trans.png";
		icon.imageMap=[0,0,0,26,26,26,26,0];

		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());

		if (document.getElementById("yerdley")) { var loc=new GLatLng(51.9934,-1.5802); }
		if (document.getElementById("yarnhill")) { var loc=new GLatLng(52.0715,-1.477); }
		if (document.getElementById("weston")) { var loc=new GLatLng(51.6775,-1.6832); }
		if (document.getElementById("wallace")) { var loc=new GLatLng(51.7935,-0.8830); }
		if (document.getElementById("vicarage")) { var loc=new GLatLng(51.8687,-1.2901); }
		if (document.getElementById("poletrees")) { var loc=new GLatLng(51.8392,-1.0432); }
		if (document.getElementById("old")) { var loc=new GLatLng(51.8255,-1.3786); }
		if (document.getElementById("homefarm")) { var loc=new GLatLng(51.9403,-1.3099); }
		if (document.getElementById("hill")) { var loc=new GLatLng(51.7969,-1.5176); }
		if (document.getElementById("forge")) { var loc=new GLatLng(51.83,-1.4241); }
		if (document.getElementById("fords")) { var loc=new GLatLng(51.6177,-1.0694); }
		if (document.getElementById("elbie")) { var loc=new GLatLng(51.8263,-1.421); }
		if (document.getElementById("ducklington")) { var loc=new GLatLng(51.6775,-1.6832); }
		if (document.getElementById("bould")) { var loc=new GLatLng(51.887,-1.6468); }
		if (document.getElementById("banbury")) { var loc=new GLatLng(51.886,-1.4717); }
		if (document.getElementById("potters")) { var loc=new GLatLng(51.8318,-1.5656); }
		if (document.getElementById("huntsmill")) { var loc=new GLatLng(52.0147,-1.0717); }
		if (document.getElementById("grange")) { var loc=new GLatLng(51.94185748147699,-1.0702872276306152); }

		map.setCenter(loc, 10);
		var mark=new GMarker(loc,icon);
		map.addOverlay(mark);
	}
}
addLoadEvent(loadmap); 
