%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/nailstv/public_html/de.nails.tv/js/admin/
Upload File :
Create Path :
Current File : /home/nailstv/public_html/de.nails.tv/js/admin/googlemap.js

var gmarkers = new Array;

function initialize()
{
    if (GBrowserIsCompatible())
    {
        var opts = new Object();
        opts.draggable = true;

        var map = new GMap2(document.getElementById("map_canvas"), { size: new GSize(760,480) }); 
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());

        var options = {
            onMarkersSetCallback : function()
            {
                this.clearMarkers();
            }
        };

        var gLocalSearchControl = new google.maps.LocalSearch(options);
        map.addControl(gLocalSearchControl);

        var mapCenter = new GLatLng(46.07227791246789, 18.233184814453125);
        map.setCenter(mapCenter, 4);

        var lat = document.getElementById('lat').value;
        var lng = document.getElementById('lng').value;
        var point = new GLatLng(parseFloat(lat), parseFloat(lng));

        if(lat != '' && lng != '')
        {
            var marker = new GMarker(point, opts);
            map.addOverlay(marker);
            gmarkers.push(marker);
            map.setCenter(point, 17);

            GEvent.addListener(marker, "dragend", function()
            {
                document.getElementById('lat').value = marker.getPoint().lat();
                document.getElementById('lng').value = marker.getPoint().lng();
            });
        }

        GEvent.addListener(map, 'click', function(overlay, point)
        {
            if (overlay)
            {
                map.removeOverlay(overlay);
                document.getElementById('lat').value = '';
			    document.getElementById('lng').value = '';
            }
            if (point)
            {
                var marker = new GMarker(point, opts);
                marker.enableDragging();

                for (i = 0; i < gmarkers.length; i++)
                {
                    map.removeOverlay(gmarkers[i]);
                    gmarkers.splice(0,1);
                }

                map.addOverlay(marker);
                gmarkers.push(marker);

                document.getElementById('lat').value = marker.getPoint().lat();
			    document.getElementById('lng').value = marker.getPoint().lng();

                GEvent.addListener(marker, "dragend", function()
                {
                    document.getElementById('lat').value = marker.getPoint().lat();
			        document.getElementById('lng').value = marker.getPoint().lng();
		        });
            }
        });
    }
}

function terkep()
{
    if(document.getElementById('map_container').style.display == 'none')
    {
        document.getElementById('map_container').style.display = 'block';
        document.getElementById('toggle_map_link').innerHTML = 'térkép elrejtése';
    }
    else
    {
        document.getElementById('map_container').style.display = 'none';
        document.getElementById('toggle_map_link').innerHTML = 'térkép megjelenítése';
    }
}

Zerion Mini Shell 1.0