%PDF- %PDF-
Mini Shell

Mini Shell

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

function initialize()
{
    if (GBrowserIsCompatible())
    {
        var map = new GMap2(document.getElementById("google_map"), { size: new GSize(gmap_w, gmap_h) } );
        map.addControl(new GSmallMapControl());

        var mapCenter = new GLatLng(47.156104775044035, 19.5062255859375);
        map.setCenter(mapCenter, 7);

        if(gmap_xml != '') {
            GDownloadUrl(gmap_xml, function(data)
            {
                var bounds = new GLatLngBounds();
                var xml = GXml.parse(data);
                var markers = xml.documentElement.getElementsByTagName("marker");

                if(markers.length < 1) {
                    document.getElementByid('google_map').style.display = 'none';
                }
                else {
                    for (var i = 0; i < markers.length; i++)
                    {
                        var id = markers[i].getAttribute("id");
                        var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                            parseFloat(markers[i].getAttribute("lng")));
                        var marker = createMarker(point, id, markers[i].childNodes[0].nodeValue);
                        map.addOverlay(marker);
                        bounds.extend(point);
                    }

                    if(gmap_autozoom) {
                        map.showBounds(bounds, paddings)
                        var zoom = map.getBoundsZoomLevel(bounds);
                        if(zoom > 15) zoom = 15;
                        map.setCenter(bounds.getCenter(), zoom);
                    }
                }
            });
        }
    }
}

function createMarker(point, id, info)
{
    var marker = new GMarker(point);
    var html = '<div class="infowindow">' + info + '</div>';

    GEvent.addListener(marker, 'click', function() {
    	marker.openInfoWindowHtml(html);
    });

    return marker;
}

var paddings = {top:30, right:10, left:50};

GMap2.prototype.showBounds = function(bounds_, opt_options)
{
    var opts = opt_options||{};
    opts.top = opt_options.top*1||0;
    opts.left = opt_options.left*1||0;
    opts.bottom = opt_options.bottom*1||0;
    opts.right = opt_options.right*1||0;
    opts.save = opt_options.save||true;
    opts.disableSetCenter = opt_options.disableSetCenter||false;
    var ty = this.getCurrentMapType();
    var port = this.getSize();
    if(!opts.disableSetCenter) {
        var virtualPort = new GSize(port.width - opts.left - opts.right, port.height - opts.top - opts.bottom);
        this.setZoom(ty.getBoundsZoomLevel(bounds_, virtualPort));
        var xOffs = (opts.left - opts.right)/2;
        var yOffs = (opts.top - opts.bottom)/2;
        var bPxCenter = this.fromLatLngToDivPixel(bounds_.getCenter());
        var newCenter = this.fromDivPixelToLatLng(new GPoint(bPxCenter.x-xOffs, bPxCenter.y-yOffs));
        this.setCenter(newCenter);
        if(opts.save)this.savePosition();
    }
    var portBounds = new GLatLngBounds();
    portBounds.extend(this.fromContainerPixelToLatLng(new GPoint(opts.left, port.height-opts.bottom)));
    portBounds.extend(this.fromContainerPixelToLatLng(new GPoint(port.width-opts.right, opts.top)));
    return portBounds;
}

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

Zerion Mini Shell 1.0