Fixed the problem. Wanted to post final version of javascript. Maybe
somebody founds it useful.
Thanks for help.

  <script type="text/javascript">
        var map;
  google.load("maps", "2");


  function initialize() {
        map = new google.maps.Map2(document.getElementById("Gmap"));
        map.setCenter(new GLatLng(56.9, 24.6), 7);

        map.setMapType(google.maps.NORMAL_MAP);
        map.addControl(new google.maps.SmallMapControl());
        map.addControl(new google.maps.MapTypeControl());


        function createMarker(point,nov,adr){
                var marker = new google.maps.Marker(point);

                GEvent.addListener(marker, "click", function() {
                marker.openInfoWindowHtml("Novietne: <b>" + nov + 
"</b><br>Adrese:
<b>" + adr + "</b>");
                        });
                return marker;
        }


        var sk = document.getElementsByName('vars').length;
        for (var i = 0; i<sk ; i++){
                var variables = document.getElementsByName('vars').item(i);
                var map_info=variables.value.split("||");
                var nr=0;
                while(nr<map_info.length){
                        //alert(map_info[nr]);
                        nr+=1;
                        var lat = map_info[0];
                        var lon = map_info[1];
                        var novietne = map_info[2];
                        var adrese = map_info[3];
                }
        var point = new google.maps.LatLng(lat, lon);

        map.addOverlay(createMarker(point,map_info[2],map_info[3]))
        //map.addOverlay(marker);
        }
  }
  google.setOnLoadCallback(initialize);


function Switch(d) {
if(d == 'Gmap'){
        document.getElementById('JSmap').style.display = "none";
        document.getElementById(d).style.display = "block";
        document.getElementById(d).style.width = "624px";
        document.getElementById(d).style.height = "470px";
        map.checkResize();
        map.setCenter(new GLatLng(56.9, 24.6), 7);
}
else if(d == 'JSmap'){
        document.getElementById('Gmap').style.display = "none";
        document.getElementById(d).style.display = "block";
}
}

</script>

On Feb 15, 3:48 pm, Andrew Leach <[email protected]>
wrote:
> On Feb 15, 1:26 pm, UPIIC <[email protected]> wrote:
>
> > Where it should be?
> > -- Im little confused about this function..
> > I understand that its functions is to set back size ofmapafter
> > button is pressed (in my case with this button i switch 2 different
> > maps). I can't understand other part of this - where to put this
> > function (I'm pretty new to Gmaps and javascript).
>
> It needs to operate on the expanded/unhidden Googlemap. That
> **probably** means it should go just before the } here:
>
>  if(d == 'Gmap'){
>   document.getElementById('JSmap').style.display = "none";
>   document.getElementById(d).style.display = "block";
>   }
>
> However, your variable "map" needs to be global if it's to be usable
> outside function initialize.

-- 
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=en.

Reply via email to