//Written by Alec Scaresbrook 2008
//www.scaresbrooks.co.uk
//The coding is divided into four sections:
//Section 1: Javascript for Google map
//Section 2: Available markers
//Section 3: Map marker overlays
//Section 4: Line 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.setUIToDefault();
     map.setMapType(G_HYBRID_MAP);
//Map navigation control
     //map.addControl(new GSmallMapControl());
//Map overview control
     var ovcontrol = new GOverviewMapControl(new GSize(170,170)); 
     //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(52.19496003,-2.206546), 16);
     map.disableScrollWheelZoom();

	 
//---------------End - Section 1: Javascript for Google map 

// --------------Start - Section 2: Available markers------------------
// icon70 - cycle route 70
// icon73 - cycle route 73
// icon55 - cycle route 55
// iconthink - road hazard
// iconorange
// iconblue
// iconyellow
// icondarkgreen
// iconred
// iconhelp - tourist information
// --------------End - Section 2: Available markers------------------

//---------------Start - Section 3: Map marker overlays
//Markers 1 - We Are Here 
//Set point co-ordinates
   var point = new GLatLng(52.19496003,-2.206546);
//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 type="text/css"><!--.style1 {	font-family: Verdana, Arial, Helvetica, sans-serif;	color: #000000;}--></style><p align="center" class="style1"><strong>WE ARE HERE </strong></p><p align="center" class="style1">Discount Carpet Warehouse<br>Unit 1 Worcester Trade Park<br>Sherriff Street<br>Worcester<br>Worcestershire<br>WR4 9AB<br><br>Phone: 01905 616111</p></div>';
//Choose a marker from the list above.
   var icontype = iconyellow;
//Create the marker
   var marker = createMarker(point,html,icontype);
//Add the overlay
   map.addOverlay(marker);


//---------------End - Section 3: Map marker overlays

//---------------Start - Section 4: Line overlays


//Example Line Overlay
var linecolor='#0000ff';var lineweight=4;var lineopacity=0.5;var gpline=new GPolyline([new GLatLng(53.16677,-2.19585), new GLatLng(53.1663,-2.19452), new GLatLng(53.16499,-2.1919), new GLatLng(53.16424,-2.18997), new GLatLng(53.16357,-2.18722), new GLatLng(53.16298,-2.18473), new GLatLng(53.1626,-2.18418), new GLatLng(53.16162,-2.1831), new GLatLng(53.15984,-2.17976)],linecolor,lineweight,lineopacity);
map.addOverlay(gpline);
//--------------------End - Section 4: Line overlays

//~If object exists - end bracket
  }
//~********************************
}
    
window.onload = load; 





