﻿function initialize() {
    if (GBrowserIsCompatible()) {
        // define the crosshair tile layer and its required functions
        var crossLayer = new GTileLayer(new GCopyrightCollection(""), 0, 15);
        crossLayer.getTileUrl =  function(tile, zoom) {
          return "./include/tile_crosshairs.png";
        }
        crossLayer.isPng = function() {return true;}

        // Create a new map type incorporating the tile layer
        var layerTerCross = [ G_PHYSICAL_MAP.getTileLayers()[0], crossLayer ];
        var mtTerCross = new GMapType(layerTerCross, G_PHYSICAL_MAP.getProjection(), "Ter+");

        var map = new GMap2(document.getElementById("map_canvas"), { size: new GSize(690,320) } );
        map.addMapType(G_PHYSICAL_MAP);
        map.addMapType(mtTerCross);
        map.setCenter(new GLatLng(51.24800, 22.568493), 16);
        map.addControl(new GLargeMapControl())

        var mapControl = new GHierarchicalMapTypeControl();
        
        // Set up map type menu relationships
        mapControl.clearRelationships();
        mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, "Labels", false);
        mapControl.addRelationship(G_PHYSICAL_MAP, mtTerCross, "Crosshairs");
  
        // Add control after you've specified the relationships
        map.addControl(mapControl);
        
        // Create our "tiny" marker icon
        var inoIcon = new GIcon(G_DEFAULT_ICON);
        //inoIcon.image = "http://ino.lublin.pttk.pl/_nowa/images/favicon.gif";
        //inoIcon.iconSize = new GSize(16, 16);
        //inoIcon.shadowSize = new GSize(0, 0);
        
        // Set up our GMarkerOptions object
		markerOptions = { icon:inoIcon };
        
        // Add a marker for InO
        latlng = new GLatLng(51.24800, 22.568700);
        var marker = new GMarker(latlng, markerOptions)
        map.addOverlay(marker);
        
        // Add info cloud
        var html = '<img src="http://ino.lublin.pttk.pl/_nowa/images/favicon.gif" alt="" title="" /> ' +
                   "<b>Klub Inochodziec</b><br />" +
                   "Oddział Miejski PTTK<br />" +
                   "ul. Rynek 8<br />" + 
                   "20-111 Lublin<br />" +
                   "tel. (81) 532-49-42<br />";
        
        marker.openInfoWindowHtml(html);
        
        GEvent.addListener(marker, "click", function() { 
            marker.openInfoWindowHtml(html);
        });
    }
 }
