﻿  // Check to see if this browser can run the Google API
  if (GBrowserIsCompatible()) {

	var initialzoomlevel = 9;
	var clickzoomlevel = 16;

    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    var baseIcon = new GIcon();
    baseIcon.shadow = "http://www.cypruswalkingfriends.com/uploads/images/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 2);
    baseIcon.infoShadowAnchor = new GPoint(18, 25);

    // Create Parking icon
    var icon = new GIcon();
    icon.image = "http://www.cypruswalkingfriends.com/uploads/images/favicon_cms.ico";
    icon.iconSize = new GSize(21, 21);
    icon.iconAnchor = new GPoint(6, 20);
    icon.infoWindowAnchor = new GPoint(5, 1);

    // functions that open the directions forms
    function tohere() {
    marker.openInfoWindowHtml(to_html);
    }
    function fromhere(i) {
    marker.openInfoWindowHtml(from_html);
    }

    // Creates a marker whose info window displays the letter corresponding
    // to the given index.
    function createMarker(point, index) {
      // Create a lettered icon for this point using our icon class
      var letter = String.fromCharCode("A".charCodeAt(0) + index);
      var letteredIcon = new GIcon(baseIcon);
      letteredIcon.image = "http://www.cypruswalkingfriends.com/uploads/images/marker" + letter + ".png";
      var   walkdescriptions =new Array(8);
            walkdescriptions[0]= '<p>Location 1<br />LIMASSOL FOREST<br />'; // Limassol
            // walkdescriptions[1]= '<p>Location 2<br />LIMASSOL HILL VILLAGES<br />'; // Limassolish
            walkdescriptions[1]= '<p>Location 2<br />WINE VILLAGES OF <br />THE TROODOS FOOTHILLS<br />'; // Limassolish
            walkdescriptions[2]= '<p>Location 3<br />CENTRAL TROODOS MASSIFF <br />INCLUDING WESTERN PITSILIA<br />'; // Limassolish
            walkdescriptions[3]= '<p>Location 4<br />EASTERN PITSILIA<br />'; // Limassolish
            walkdescriptions[4]= '<p>Location 5<br />PAFOS FOREST <br />EASTERN AREA<br />'; // Limassolish
            walkdescriptions[5]= '<p>Location 6<br />TILLIRIA WILDERNESS AND <br />WESTERN PAFOS FOREST<br />'; // Limassolish       
            walkdescriptions[6]= '<p>Location 7<br />AKAMAS PENINSULAR<br />'; // Limassolish

      // Set up our GMarkerOptions object
      markerOptions = { icon:letteredIcon };
      var   marker = new GMarker(point, markerOptions);
        
      GEvent.addListener(marker, "click", function() {
       map.setCenter(point, clickzoomlevel)
       marker.openInfoWindowHtml(walkdescriptions[index]);
      });
    return marker;
    }
    // Display the map, with some controls and set the initial location
    // G_SATELLITE_MAP = satellite map
    
    	// Mark the office
	// var office = new GLatLng( 34.776295,33.152798);
	// var officeloc = new GMarker(office, icon);
	
    // Set up Walk Locations with Info
    
    var walklocations =new Array(8);
        walklocations[0]= new GLatLng( 34.78403,33.121323); // A - Limassol Forest: Mount Kyperisia
      //  walklocations[1]= new GLatLng( 34.828117,33.196846); // B - Limassol Villages: Vickla Golf Course
        walklocations[1]= new GLatLng( 34.847965,32.808575); // B - Troodos Wine Villages: Omodos
        walklocations[2]= new GLatLng( 34.94167,32.86667); // C - Troodos Massiff and Westwern Pitsilia: Mount Olympus
        walklocations[3]= new GLatLng( 34.920105,33.19159); // D - Eastern Pitsilia: Mount Kionia
        walklocations[4]= new GLatLng( 34.896606,32.775627); // E - Eastern Pafos Forest: Elia Bridge
        walklocations[5]= new GLatLng( 35.00369,32.676704); // F - Western Pafos Forest /Tirilia: Mount Tryplos       
        walklocations[6]= new GLatLng( 35.02303,32.33353); // G - Akamas:Smigies Picnic Site

     
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.setCenter(walklocations[2], initialzoomlevel);
    map.addMapType(G_SATELLITE_MAP);
    map.setMapType(G_SATELLITE_MAP);
  
//      GEvent.addListener(officeloc, 'click', function() {
//      map.setCenter(office, clickzoomlevel)
//      officeloc.openInfoWindowHtml("Office");
//    });
//    map.addOverlay(officeloc);
        
	for (var i = 0; i < 7; i++) {
        map.addOverlay(createMarker(walklocations[i], i));
        }


  }