I get the error "InfoBox is undefined". Because there is a typo in your post (is it in your real code).
Then I see markers (obviously not your custom ones, as you didn't provide the correct URL).
If I click on a marker, I get an error: Error: 'infobox' is undefined
.
If I fix that by moving the declaration of the "infobox" variable to the global scope, it works with no errors, but there is no content for the infoboxes...
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox.js"></script>
<script type="text/javascript">
var geocoder;
var map;
var markers = [];
var infobox= new InfoBox();
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(54.899114,-1.730348);
var boxText = document.createElement("div");
boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: yellow; padding: 5px;";
boxText.innerHTML = "City Hall, Sechelt<br>British Columbia<br>Canada";
var boxOptions = {
content: boxText
,disableAutoPan: false
,maxWidth: 0
,pixelOffset: new google.maps.Size(-140, 0)
,zIndex: null
,boxStyle: {
background: "url('tipbox.gif') no-repeat"
,opacity: 0.75
,width: "280px"
}
,closeBoxMargin: "10px 2px 2px 2px"
,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
,infoBoxClearance: new google.maps.Size(1, 1)
,isHidden: false
,pane: "floatPane"
,enableEventPropagation: false
};
var myOptions = {
zoom: 8,
//scrollwheel: false,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("gmap"), myOptions);
addPostCode('POSTCODE');
addPostCode('POSTCODE');
addPostCode('POSTCODE');
}
function addPostCode(zip) {
geocoder.geocode( { 'address': zip}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK)
{
var iconBase = 'http://www.mywebsite.co.uk/images/';
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
url:'http://www.google.com',
map: map,
position: results[0].geometry.location,
name: zip /*,
icon: iconBase + 'icon.png' */
//shadow: iconBase + 'schools_maps.shadow.png'
});
google.maps.event.addListener(marker, 'click', function() {
//window.location.href = marker.url;
infobox.setContent('test');
infobox.open(map, marker);
});
markers.push(marker);
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
</script>