function createMarker(longitude,latitude,infotext) {
	var thePoint  = new GPoint(longitude,latitude);
	var theMarker = new GMarker(thePoint);

	if (infotext > "") {
		GEvent.addListener(theMarker,"click",function() {
			theMarker.openInfoWindowHtml(infotext);
		});
	}

	return theMarker;
}

function mapWithMarker() {
	var containerDiv = document.getElementById("map");

	// CREATE THE MAP OBJECT
	var map = new GMap2(containerDiv);

	// ADD CONTROLS (DEPENDING ON HOW BIG THE MAP IS)
	if (containerDiv.offsetHeight > 350) {
		map.addControl(new GLargeMapControl());
	} else {
		map.addControl(new GSmallMapControl());
	}

	map.setCenter(new GLatLng(54.5547,-1.3109), 11);

	// COMMERCIAL + PROPERTY MANAGEMENT + SURVEY OFFICES
	var theMarker = createMarker(-1.3309,54.5477,"<strong>Innovation Court, TS18 3DA</strong><br /><a href=\"survey-office.asp\">Survey + Valuation Office</a><br /><a href=\"commercial-office.asp\">Commercial Office</a><br /><a href=\"property-management-office.asp\">Property Management Office</a>");
	map.addOverlay(theMarker);

	// FINANCIAL + STOCKTON OFFICES
	var theMarker = createMarker(-1.312,54.5652,"<strong>Residential Sales<br />Bishop Street, TS18 1SY</strong><br /><a href=\"stockton-office.asp\">Stockton Office</a>");
	map.addOverlay(theMarker);

	// INGLEBY BARWICK
	// var theMarker = createMarker(-1.3094,54.5235,"<strong>Residential Sales<br />Greenside, TS17 0RR</strong><br /><a href=\"ingleby-barwick-office.asp\">Ingleby Barwick Office</a>");
	// map.addOverlay(theMarker);

	// NORTON
	var theMarker = createMarker(-1.3097,54.5876,"<strong>Residential Sales<br />High Street, TS20 1DN</strong><br /><a href=\"norton-office.asp\">Norton Office</a>");
	map.addOverlay(theMarker);

	// YARM
	// var theMarker = createMarker(-1.35364,54.5085,"<strong>Residential Sales<br />High Street, TS15 9AE</strong><br /><a href=\"yarm-office.asp\">Yarm Office</a>");
	// map.addOverlay(theMarker);

	return true;
}

mapWithMarker();