//The coding is divided into four sections:
//Section 1: Javascript for Google map
//Section 2: Available markers
//Section 3: Map marker overlays
//
//This file runs in conjunction with markers.js and the image files in the 'markers' folder.

function load() {
//~Check to see if object exists
    if (document.getElementById("map"))
    {

//--------------Start - Section 1: Javascript for Google map 
       var map = "";
       function createMarker(point,html,icons) 
       {var emarker = new GMarker(point,icons);
        GEvent.addListener(emarker, "click", function() {
          emarker.openInfoWindowHtml(html);
        });return emarker;} 

//Create the map
     map = new GMap2(document.getElementById("map"));
//Map navigation control
     map.addControl(new GSmallMapControl());
//Map overview control
     var ovcontrol = new GOverviewMapControl(new GSize(125,100)); 
     map.addControl(ovcontrol);
//Type of map control
     map.addControl(new GMapTypeControl());
//Set the map centre using latitude and longitude co-ordinates and set the opening zoom level of the map. 
//The smaller the number, the smaller the scale. For example, replacing 14 with 1 will display the whole world.
     map.setCenter(new GLatLng(50.762739240688795,-1.6903495788574219), 11);
//---------------End - Section 1: Javascript for Google map 

// --------------Start - Section 2: Available markers------------------
// iconhelp - venue
// iconblue - supermarkets
// iconyellow - b&bs
// icondarkgreen - airports
// iconred - train stations
// iconthink
// iconorange
// --------------End - Section 2: Available markers------------------

//---------------Start - Section 3: Map marker overlays
//Conception Venue 
//Set point co-ordinates
   var point = new GLatLng(50.740984,-1.68727);
//This is the text that appears in the info window. Note that the double quotes are nested within the single quotes in this coding.
//Ensure there are no hard returns within the characters between the single quotes.
   var html = '<div style="width:200px"><h3 style="color: #000;">Conception</h3><p style="color: #000;">Naish Holiday Village, Highcliffe, Christchurch, near Bournemouth, BH25 7RE</p></div>';
//Choose a marker from the list above.
   var icontype = iconhelp;
//Create the marker
   var marker = createMarker(point,html,icontype);
//Add the overlay
   map.addOverlay(marker);
   
//Tesco's
   var point = new GLatLng(50.750522,-1.64546);
   var html = '<div style="width:200px"><h3 style="color: #000;">Tesco</h3><p style="color: #000;">Caird Avenue, New Milton, Hampshire, BH25 6BP<br /><br />Telephone: 0845 677 9489<br /><br />Opening hours: Mon-Wed 0830-2200, Thurs-Fri 0800-2200, Sat 0700-2200, Sun 1000-1600</p></div>';
   var icontype = iconblue;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//Sainsbury's
   var point = new GLatLng(50.744392,-1.741204);
   var html = '<div style="width:200px"><h3 style="color: #000;">Sainsbury\'s</h3><p style="color: #000;">1 Lyndhurst Road, Christchurch, Dorset, BH23 4RY<br /><br />Tel: 01425 277885<br />Fax: 01425 276798<br /><br />Opening hours: Mon-Fri 0700-2300, Sat 0700-2200, Sun 1000-1600</p></div>';
   var icontype = iconblue;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//Sea Corner B&B
   var point = new GLatLng(50.741235,-1.6961);
   var html = '<div style="width:200px"><h3 style="color: #000;">Sea Corner</h3><p style="color: #000;">(this is also an Italian restaurant)<br /><br />397 Waterford Road<br />Highcliffe<br />Christchurch<br />BH23 5JN<br /><br />Tel: 01425 272731<br /><a href="http://www.seacorner-guesthouse.co.uk/">www.seacorner-guesthouse.co.uk</a></p></div>';
   var icontype = iconyellow;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//The Beach Tree B&B
   var point = new GLatLng(50.742177,-1.693828);
var html = '<div style="width:200px"><h3 style="color: #000;">The Beech Tree</h3><p style="color: #000;">2 Stuart Road<br />Highcliffe<br />Dorset<br />BH23 5JS<br />Tel: 01425 272038</p></div>';
   var icontype = iconyellow;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//Chewton Edge B&B
   var point = new GLatLng(50.7514,-1.699414);
var html = '<div style="width:200px"><h3 style="color: #000;">Chewton Edge</h3><p style="color: #000;">127 Ringwood Road<br />Walkford<br />Christchurch<br />BH23 5RB<br />Tel: 01425 271430<br /><a href="http://www.chewtonedge.co.uk/">www.chewtonedge.co.uk</a></p></div>';
   var icontype = iconyellow;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//Eureka Guesthouse B&B
   var point = new GLatLng(50.739093,-1.671251);
var html = '<div style="width:200px"><h3 style="color: #000;">Eureka Guesthouse</h3><p style="color: #000;">81 Sea Road<br />Barton on Sea<br />New Milton<br />Hants<br />BH25 7ND<br />Tel: 01425 610289</p></div>';
   var icontype = iconyellow;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//Castle Lodge B&B
   var point = new GLatLng(50.73943,-1.71129);
var html = '<div style="width:200px"><h3 style="color: #000;">Castle Lodge</h3><p style="color: #000;">173 Lymington Road<br />Highcliffe<br />Dorset<br />BH23 4JS<br />Tel: 01425 275170</p></div>';
   var icontype = iconyellow;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);
   
//The White House B&B
   var point = new GLatLng(50.742634,-1.69503);
var html = '<div style="width:200px"><h3 style="color: #000;">The White House</h3><p style="color: #000;">428 Lymington Road<br />Highcliffe<br />Dorset<br />BH23<br />Tel: 01425 271279</p></div>';
   var icontype = iconyellow;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//premiertravelinn.com B&B
   var point = new GLatLng(50.741261,-1.744879);
var html = '<div style="width:200px"><h3 style="color: #000;">premiertravelinn.com</h3><p style="color: #000;">Christchurch East<br />Somerford Road<br />Christchurch<br />BH23 3QG<br />Tel: 08701 977 063<br />Fax: 01202 474939<br /><a href="www.premierinn.com/pti/hotelInformation.do?hotelId=23863">www.premierinn.com/pti/hotelInformation.do?hotelId=23863</a></p></div>';
   var icontype = iconyellow;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//Southampton Airport
   var point = new GLatLng(50.95039,-1.36155);
var html = '<div style="width:200px"><h3 style="color: #000;">Southampton Airport</h3><p style="color: #000;"><a href="http://www.southamptonairport.com/">www.southamptonairport.com</a></p></div>';
   var icontype = icondarkgreen;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//Bournemouth Airport
   var point = new GLatLng(50.779275,-1.832037);
var html = '<div style="width:200px"><h3 style="color: #000;">Bournemouth Airport</h3><p style="color: #000;"><a href="http://www.flybournemouth.com/">www.flybournemouth.com</a></p></div>';
   var icontype = icondarkgreen;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//Christchurch Train Station
   var point = new GLatLng(50.738285,-1.784297);
var html = '<div style="width:200px"><h3 style="color: #000;">Christchurch Train Station</h3><p style="color: #000;">Stour Road<br />Christchurch<br />BH23 1PL<br /><a href="http://www.nationalrail.co.uk/stations/chr/details.html">www.nationalrail.co.uk/stations/chr/details.html</a><br /><a href="http://traintaxi.co.uk/detail.php?webcode=6095">Taxi information</a></p></div>';
   var icontype = iconred;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//New Milton Train Station
   var point = new GLatLng(50.755592,-1.657727);
var html = '<div style="width:200px"><h3 style="color: #000;">New Milton Train Station</h3><p style="color: #000;">Station Road<br />New Milton<br />BH25 6JS<br /><a href="http://www.nationalrail.co.uk/stations/nwm/details.html">www.nationalrail.co.uk/stations/nwm/details.html</a><br /><a href="http://traintaxi.co.uk/detail.php?webcode=3466">Taxi information</a></p></div>';
   var icontype = iconred;
   var marker = createMarker(point,html,icontype);
   map.addOverlay(marker);

//---------------End - Section 3: Map marker overlays

//~If object exists - end bracket
  }
//~********************************
}
    
window.onload = load; 