﻿function pageLoad()
{
  if (GBrowserIsCompatible()) {
    var lat = parseFloat($get('m_C_mapLatitude').value);
    var lng = parseFloat($get('m_C_mapLongitude').value);
    var zoom = parseInt($get('m_C_mapZoomLevel').value);
    var userGuid = $get('m_C_userGuid').value;
    
    mapdiv = document.getElementById("map");
    map = new google.maps.Map2(mapdiv);
    map.setUIToDefault(); 

   
    var start = new GLatLng(lat, lng);
    map.setCenter(start, zoom);
    
    if (userGuid != "")
    {
      var geoXml = new GGeoXml("http://www.ittvoltam.hu/georss.aspx?id="+userGuid);
      map.addOverlay(geoXml);
      
      try
      {
        var minLatitude = parseFloat($get('m_C_minLatitude').value);
        var minLongitude = parseFloat($get('m_C_minLongitude').value);
        var maxLatitude = parseFloat($get('m_C_maxLatitude').value);
        var maxLongitude = parseFloat($get('m_C_maxLongitude').value);
        var gbounds = new GLatLngBounds(new GLatLng(minLatitude, minLongitude), new GLatLng(maxLatitude, maxLongitude));
        map.setCenter(gbounds.getCenter(), map.getBoundsZoomLevel(gbounds));
      }
      catch (e)
      {
      }
    }

    showLatLng(map.getCenter());
    showZoom();
    
    updateSmallMap(); 

    
    //GEvent.addDomListener(mapdiv, "DOMMouseScroll", map.wheelZoom); // Firefox 
    //GEvent.addDomListener(mapdiv, "mousewheel", map.wheelZoom); // IE 
   
    GEvent.addListener(map, "mousemove", function(point) { 
      showLatLng(point);
    }); 

    GEvent.addListener(map, "zoomend", function(oldLevel, newLevel) {
      showZoom();
    });
  }
}
    
function pageUnload()
{
  GUnload();
}

if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();


