//<![CDATA[
var allMarkers = new Array();
var map;

function loadFP() 
{
  if (GBrowserIsCompatible()) 
  {
    var baseIcon = new GIcon();
    baseIcon.iconSize=new GSize(20,44);
    baseIcon.shadowSize=new GSize(40,78);
    baseIcon.iconAnchor=new GPoint(17,50);
    baseIcon.infoWindowAnchor=new GPoint(16,0);
    
    var fil = new GIcon(baseIcon, "/common/images/statendam3.png", null, "");
    
    var map = new GMap2(document.getElementById("map"));

    map.setCenter(new GLatLng(51.92134, 4.48810), 16, G_NORMAL_MAP);

    var point1 = new GPoint(4.48810, 51.92134);
    /* var html1 = "<b>CITYBUILDING STATENDAM</b><br /> Botersloot 64<br />3500 HE Rotterdam"*/
    var stat = new GMarker(point1, fil);
    /* GEvent.addListener(stat, "click", function() {stat.openInfoWindowHtml(html1)});*/
    map.addOverlay(stat);
  }
}

function loadKomLangs() 
{
  if (GBrowserIsCompatible()) 
  {
    var baseIcon = new GIcon();
    baseIcon.iconSize=new GSize(22,27);
    baseIcon.shadowSize=new GSize(40,78);
    baseIcon.iconAnchor=new GPoint(0,30);
    baseIcon.infoWindowAnchor=new GPoint(16,0);
    
    var fil = new GIcon(baseIcon, "/common/images/arrow_maps_small.png", null, "");
    
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());

    map.setCenter(new GLatLng(51.92259, 4.48720), 16, G_NORMAL_MAP);

    var point1 = new GPoint(4.48795, 51.92195);
    var stat = new GMarker(point1, fil);
    map.addOverlay(stat);
  }
}

function load() 
{
  if (GBrowserIsCompatible()) 
  {  
    // this variable will collect the html which will eventually be placed in the side_bar
    var side_bar_html = "";
  
    // arrays to hold copies of the markers and html used by the side_bar
    // because the function closure trick doesnt work there
    var i = 0;

    // A function to create the marker and set up the event window
    function createMarker(point,name,html1,html2,label1,label2) 
    {
      var marker = new GMarker(point);
      GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowTabsHtml([new GInfoWindowTab(label1,html1), new GInfoWindowTab(label2,html2)]);
      });
      // save the info we need to use later for the side_bar
      allMarkers.push(marker);
      // add a line to the side_bar html
      side_bar_html += '<a style="color: #075FB9; text-decoration: none;" href="#" onclick="myclick(' + i + ')">' + name + '</a><br>';
      i++;
      return marker;
    }

    // create the map
    map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(51.922784, 4.487300), 17);
    
    // add the points    
//    var point = new GLatLng(51.922784, 4.487300);
//    var marker = createMarker(point,"<u>CITYBUILDING STATENDAM</u>","<img height='150' width='75' src='/common/images/StatendamTab.jpg'>","TAB 2","Statendam","title 2")
//    map.addOverlay(marker);

//    var point = new GLatLng(51.920060, 4.489590);
//    var marker = createMarker(point,"Kubushuizen","<div class='txt1' >Kubushuizen Rotterdam</div>","TAB 2","Kubushuizen","title 2")
//    map.addOverlay(marker);

//    var point = new GLatLng(51.909880, 4.485000);
//    var marker = createMarker(point,"Eurasmusbrug","<img height='100' width='200' src='http://www.minbuza.nl/binaries/afbeeldingen-nieuw/foto-album/nederland-in-beelden/detailfoto-s/023.jpg'>","TAB 2","Erasmusbrug","Wist-u-dat?")
//    map.addOverlay(marker);

    // put the assembled side_bar_html contents into the side_bar div
    //document.getElementById("side_bar").innerHTML = side_bar_html;
  }
  else 
  {
    alert("Sorry, the Google Maps API is not compatible with this browser");
  }
}

// This function picks up the click and opens the corresponding info window
function myclick(i)
{
  GEvent.trigger(allMarkers[i], "click");
}


    /*if (GBrowserIsCompatible()) 
      {
        var StatIcon = new GIcon();
        StatIcon.iconSize=new GSize(35,65);
        StatIcon.shadowSize=new GSize(40,78);
        StatIcon.iconAnchor=new GPoint(15,60);
        StatIcon.infoWindowAnchor=new GPoint(16,0);

        var fil = new GIcon(StatIcon, "/common/images/Statendam2.png", null, "");
        var fil2 = new GIcon(KubusIcon, "/common/images/Kubussen2.png", null, "");
        var fil3 = new GIcon(ErasmusIcon, "/common/images/Erasmusbrug.png", null, "");
        var fil4 = new GIcon(EuromastIcon, "/common/images/Euromast.png", null, "");

        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
       
        control = new GMapTypeControl();
        map.addControl(control); 
        control = new GScaleControl();
        map.addControl(control);
        
        map.setCenter(new GLatLng(51.918299, 4.477429), 14);

        var point1 = new GPoint(4.487300, 51.922784);
        var html1 = "<b>CITYBUILDING STATENDAM</b><br />Botersloot 173<br />3500 HE Rotterdam"
        var stat = new GMarker(point1, fil);
        GEvent.addListener(stat, "click", function() {stat.openInfoWindowHtml(html1)});
        map.addOverlay(stat);*/

        /* var point2 = new GPoint(4.489590, 51.919560);
        var html2 = "<b> Kubushuizen</b>"
        var kubus = new GMarker(point2, fil2);
        GEvent.addListener(kubus, "click", function() {kubus.openInfoWindowHtml(html2)});
        map.addOverlay(kubus);
        
        var point3 = new GPoint(4.485000, 51.907880);
        var html3 = "<b>Eurasmusbrug</b>"
        var erasmus = new GMarker(point3, fil3);
        GEvent.addListener(erasmus, "click", function() {erasmus.openInfoWindowHtml(html3)});
        map.addOverlay(erasmus);
        
        var point4 = new GPoint(4.467518, 51.905803);
        var html4 = "<b>Euromast</b>"
        var euromast = new GMarker(point4, fil4);
        GEvent.addListener(euromast, "click", function() {euromast.openInfoWindowHtml(html4)});
        map.addOverlay(euromast);
      }

    else 
      {
        alert("Sorry, the Google Maps API is not compatible with this browser");
      }
    */
  

    //]]>