source: extensions/GMaps/js/gmaps.js @ 7054

Last change on this file since 7054 was 7054, checked in by grum, 14 years ago

First commit

File size: 1.6 KB
Line 
1
2var viewportInitialized = false;
3
4function applyMap(properties)
5{
6  var latlng=new google.maps.LatLng(gmaps.coords.latitude, gmaps.coords.longitude);
7
8  var map = new google.maps.Map($("#"+properties.id).get(0),
9    {
10      mapTypeId: properties.mapTypeId,
11      zoom: properties.zoomLevel,
12      center:latlng,
13      navigationControl: true,
14      scaleControl: false,
15      mapTypeControl:true,
16      mapTypeControlOptions:
17        {
18          style:google.maps.MapTypeControlStyle.DROPDOWN_MENU
19        },
20      markerTitle:'',
21    }
22  );
23
24  if(properties.displayMarker)
25  {
26    var marker = new google.maps.Marker(
27      {
28        position:latlng,
29        map: map,
30        title:properties.markerTitle
31      }
32    );
33    properties.gMarker=marker;
34  }
35
36  properties.gMap=map;
37  properties.gMapCenter=latlng;
38}
39
40$(window).load(function ()
41  {
42    for(i=0;i<gmaps.maps.length;i++)
43    {
44      applyMap(gmaps.maps[i]);
45    }
46
47    /*
48     * this is need for the gally template, because the map initialisation don't
49     * works if the container is not visible
50     */
51    tabId=$('#iGMaps0').get(0).parentNode.parentNode.parentNode.id;
52    tabId='tab'+tabId.toUpperCase().substring(0,1)+tabId.substr(1);
53    $("#"+tabId+" a").bind('click', function ()
54     {
55        if(viewportInitialized==false)
56        {
57          for(i=0;i<gmaps.maps.length;i++)
58          {
59            google.maps.event.trigger(gmaps.maps[i].gMap, 'resize');
60            gmaps.maps[i].gMap.setCenter(gmaps.maps[1].gMapCenter);
61            $('#'+gmaps.maps[i].id+' span, #'+gmaps.maps[i].id+' a').css('font-size', '55.0%');
62          }
63        }
64        viewportInitialized=true;
65     }
66    );
67  }
68);
69
70
Note: See TracBrowser for help on using the repository browser.