﻿var GoogleMap = function(mapSelector, pushpins) {
    this.geocoder = null;
    this.map = null;
    this.pushpinHelper = null;
    this.init = function() {
        this.map = new GMap2(document.getElementById(mapSelector));    //This is show map.
        this.map.addControl(new GLargeMapControl3D()); //(new GSmallMapControl());

        this.geocoder = new GClientGeocoder();  //This is show address on popup in map.
        PushpinHelper.prototype.pushpins = pushpins;
        this.pushpinHelper = new PushpinHelper(this.map, this.geocoder);
        delete GoogleMap.pushpins;
    };
    this.showMap = function() {
        //debugger;
        if (!GBrowserIsCompatible()) return;
        this.init();
        this.pushpinHelper.refresh();
    };
    this.zoomIn = function() {
        this.map.zoomIn();
    };

    this.zoomOut = function() {
        this.map.zoomOut();
    };

    this.setMapType = function(p) {
        var map = this.map;
        if (p == "G_MAP_TYPE")
        { map.setMapType(G_NORMAL_MAP); }
        else if (p == "G_SATELLITE_TYPE")
        { map.setMapType(G_SATELLITE_MAP); }
        else if (p == "G_HYBRID_TYPE")
        { map.setMapType(G_HYBRID_MAP); };
        /*else map.setMapType(G_SATELLITE_3D_MAP );*/
    }
}