// JavaScript Document
/*
	2009 Salveo (R)
	
	To make this functions work, the Google Maps javascript must be already added to the document.

*/
var map;

function loadminimap(node, lat, lng, zoom) {
	
      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(node) /*,
            { size: new GSize(200, 150) }*/ );
        map.addMapType(G_PHYSICAL_MAP);
        map.addMapType(mtTerCross);
        map.setCenter(new GLatLng(lat, lng), zoom);
        //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);
		
		var marker = new GMarker(new GLatLng(lat, lng)); 
		map.addOverlay(marker); 
		
      }
    }

function loadmap(node, lat, lng, zoom) {
	
      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+");

        map = new GMap2(document.getElementById(node) );
        map.addMapType(G_PHYSICAL_MAP);
        map.addMapType(mtTerCross);
        map.setCenter(new GLatLng(lat, lng), zoom);
        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);
		
		/*
		var marker = new GMarker(new GLatLng(lat, lng), {draggable: true}); 
		marker.map = map;
		map.addOverlay(marker); 
		return marker;
		*/
      }
}

function enlargemap(lat, lng, zoom)
{
	window.open(
				'/dlg_largemap.php?lat=' + lat + '&lng=' + lng + '&zoom=' + zoom,
				'frmLargeMap',
				'width=650, height=550, toolbar=no, menubar=no'
				);
}

