Hi, i have two function, one the init that initialize the map:

function init() {

        var type;
        var allTypes = { 'All':[] };

        document.getElementById('button-sidebar-hide').onclick = function()
{ return changeBodyClass('sidebar-right', 'nosidebar'); };
        document.getElementById('button-sidebar-show').onclick = function()
{ return changeBodyClass('nosidebar', 'sidebar-right'); };
        handleResize();

        map = new GMap(document.getElementById("map"));
        map.addControl(new GMapTypeControl());
        map.addControl(new GSmallMapControl());
        map.setCenter(new GLatLng(centerlat, centerlong), startZoom);
        GEvent.addListener(map,'zoomend',function() {
        updateMarkers();
        });
        GEvent.addListener(map,'moveend',function() {
        updateMarkers();
        });

        for(id in markers) {


                initializePoint(markers[id]);
                allTypes[markers[id].type] = true;
        }

        for(type in allTypes) {
                initializeSortTab(type);
        }


        changeBodyClass('loading', 'standby');

}


 the second is updateMarkers that is the same as init but without this
part:

map = new GMap(document.getElementById("map"));
        map.addControl(new GMapTypeControl());
        map.addControl(new GSmallMapControl());
        map.setCenter(new GLatLng(centerlat, centerlong), startZoom);
        GEvent.addListener(map,'zoomend',function() {
        updateMarkers();
        });
        GEvent.addListener(map,'moveend',function() {
        updateMarkers();
        });

Theese are the functions that create markers:

function initializePoint(pointData) {
        var point = new GLatLng(pointData.lat, pointData.lng);

        var marker = new GMarker(point);

        var listItem = document.createElement('li');
        var listItemLink = listItem.appendChild(document.createElement('a'));
        var visible = false;

        listItemLink.href = "#";
        listItemLink.innerHTML = '<strong>' + pointData.city + ' </
strong><span>' + pointData.city + '</span>';

        var focusPoint = function() {
                deselectCurrent();
                listItem.className = 'current';
                deselectCurrent = function() { listItem.className = ''; }
                marker.openInfoWindowHtml( pointData.city );
                map.panTo(point);
                //map.setZoom(14)
                return false;
        }

        GEvent.addListener(marker, 'click', focusPoint);
        listItemLink.onclick = focusPoint;


        pointData.show = function() {
                if (!visible) {
                        
document.getElementById('sidebar-list').appendChild(listItem);
                        map.addOverlay(marker);
                        visible = true;
                }
        }
        pointData.hide = function() {
                if (visible) {
                        
document.getElementById('sidebar-list').removeChild(listItem);
                        map.removeOverlay(marker);
                        visible = false;

                }
        }

        pointData.show();

}


function initializeSortTab(type) {


        var listItem = document.createElement('li');
        var listItemLink = listItem.appendChild(document.createElement('a'));

        listItemLink.href = "#";
        listItemLink.innerHTML = type;
        listItemLink.onclick = function() {
                changeBodyClass('standby', 'loading');

                for(id in markers) {
                        if (markers[id].type == type || 'All' == type)
                                markers[id].show();
                        else
                                markers[id].hide();
                }

                changeBodyClass('loading', 'standby');

                return false;
        }

        document.getElementById('filters').appendChild(listItem);
}




It works ok when i call init function but when i move or zoom the map
the filter buttons in toolbar wont work anymore evenif also in the
updateMarkers i have set:

        var type;
        var allTypes = { 'All':[] };

I can't post the map because i'm in localhost...
Any help?

--

You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=.


Reply via email to