function maincreateMarker(mainpoint,mainhtml) {
}
var mainmap;
var maingdir;
var maingeocoder = null;
var mainaddressMarker;
var mainhtml="Home of <span style='color:red;'>RHC COUGARS RFC</span><br/>"+
"<img src='UPClubhouse.jpg' " + "<img src='logo2.gif' " +
"width='80' height='60'/> <br/>" + "Union Park<br/>";


 function load1() {
if (GBrowserIsCompatible()) { mainmap = new GMap2(document.getElementById("map_canvas"));
maingdir = new GDirections(mainmap, document.getElementById("directions"));
GEvent.addListener(maingdir, "load", onGDirectionsLoad);
GEvent.addListener(maingdir, "error", handleErrors);
mainmap.addControl(new GSmallMapControl());
mainmap.addControl(new GMapTypeControl());
mainmap.setCenter(new GLatLng(55.934912, -3.275986), 13);
//(55.955165,-3.278764) are RHC UP coordinates
mainmap.openInfoWindowHtml(mainmap.getCenter(),mainhtml);
// mainmap.zoomOut()
setDirections("RHC Cougars RFC, Carrick Knowe Pkwy @55.934912, -3.275986", "Royal High School @55.965220, -3.283550", "en_UK");
}
}
function setDirections(fromAddress, toAddress) {
maingdir.load("from: " + fromAddress + " to: " + toAddress);
}


function handleErrors(){
if (maingdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + maingdir.getStatus().code);
else if (maingdir.getStatus().code == G_GEO_SERVER_ERROR)
alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + maingdir.getStatus().code);
else if (maingdir.getStatus().code == G_GEO_MISSING_QUERY)
alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + maingdir.getStatus().code);
// else if (maingdir.getStatus().code == G_UNAVAILABLE_ADDRESS) <--- Doc bug... this is either not defined, or Doc is wrong
// alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + maingdir.getStatus().code);
else if (maingdir.getStatus().code == G_GEO_BAD_KEY)
alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + maingdir.getStatus().code);
else if (maingdir.getStatus().code == G_GEO_BAD_REQUEST)
alert("A directions request could not be successfully parsed.\n Error code: " + maingdir.getStatus().code);
else alert("An unknown error occurred.");
}
function onGDirectionsLoad(){ // Use this function to access information about the latest load()



//add markers and popups

var mainicon = new GIcon();
mainicon.image = "smallcougarsicon6.png";
mainicon.shadow = "smallcougarsiconshadow4.png";
mainicon.iconSize = new GSize(60.0, 62.0);
mainicon.shadowSize = new GSize(90.0, 60.0);
mainicon.iconAnchor = new GPoint(0.0, 59.0);
mainicon.infoWindowAnchor = new GPoint(0.0, 59.0);
function mainmaincreateMarker(mainpoint, mainmessage, mainalttext, maintype) {
var mainmarker = new GMarker(mainpoint, {mainicon: maintype, maintitle: mainalttext});
GEvent.addListener(mainmarker, "click", function() {
mainmarker.openInfoWindowHtml(mainmessage, {maxWidth: 204});
});
return mainmarker;
}
mainmap.addOverlay(maincreateMarker(new GLatLng(55.965220, -3.283550), '<h5>RHS Playing Fields</h5> <img src="RHClubhouse.jpg" border="0" class="thumbnail" align="left" alt="View of RHS"><p>RHS Playing Fields </p><p> are situated in the Barnton area of North Edinburgh.</p><p> The rugby club have access to the clubhouse of the RHS Athletic Club with bar,  changing rooms and shower facilities</p>. ', 'RHC COUGARS', mainicon));

var mainicon = new GIcon();
mainicon.image = "smallcougarsicon5.png";
mainicon.shadow = "smallcougarsiconshadow4.png";
mainicon.iconSize = new GSize(60.0, 62.0);
mainicon.shadowSize = new GSize(90.0, 60.0);
mainicon.iconAnchor = new GPoint(0.0, 59.0);
mainicon.infoWindowAnchor = new GPoint(0.0, 59.0);
function maincreateMarker(mainpoint, mainmessage, mainalttext, maintype) {
var mainmarker = new GMarker(mainpoint, {mainicon: maintype, maintitle: mainalttext});
GEvent.addListener(mainmarker, "click", function() {
mainmarker.openInfoWindowHtml(mainmessage, {maxWidth: 204});
});
return mainmarker;
}
mainmap.addOverlay(maincreateMarker(new GLatLng(55.934912, -3.275986), '<table cellpadding="0" cellspacing="1" border="0" width="100%"><tr><td class="tableHeader"><a href="addtext.htm" title="View of Union Park">Union Park</a></td></tr><tr><td class="tableCell"><a href="addtext.htm"><img src="UPClubhouse.jpg" border="0" class="thumbnail" align="left" alt="View of Union Park"></a><b>Union Park</b> is the official clubhouse of RHC COUGARS and is situated in the Corstophine area of West Edinburgh<a href="addtext.htm">More about RHC COUGARS</a></td></tr><tr><td class="tableCell"><a href="http://#</a><br></td></tr></table>', 'RHC COUGARS', mainicon));

}


