﻿Type.registerNamespace("Feratel.Website.Tosc");

// constructor
Feratel.Website.Tosc.GMapPosition = function(mapContainerId, lng, lat, selectedMapType, mapTypes) {
    this._mapContainerId = mapContainerId;
    this._lat = lat;
    this._lng = lng;
    this._selectedMapType = selectedMapType;
    this._mapTypes = mapTypes;
    this._mapContainer;
    this._mapObject;
    this._events = new Sys.EventHandlerList();

}
//class definition
Feratel.Website.Tosc.GMapPosition.prototype = {
    initialize: function() {
        if (this._mapObject == null) {
            this._mapContainer = $get(this._mapContainerId);
            var latlng = new google.maps.LatLng(this._lat, this._lng);
            
            var mapTypeIds = new Array();
            var selectedMapTypeId = 1;
            if ((this._mapTypes & 1) == 1) mapTypeIds[mapTypeIds.length] = google.maps.MapTypeId.ROADMAP;
            if ((this._mapTypes & 2) == 2) mapTypeIds[mapTypeIds.length] = google.maps.MapTypeId.SATELLITE;
            if ((this._mapTypes & 4) == 4) mapTypeIds[mapTypeIds.length] = google.maps.MapTypeId.HYBRID;
            if ((this._mapTypes & 8) == 8) mapTypeIds[mapTypeIds.length] = google.maps.MapTypeId.TERRAIN;
            if (this._selectedMapType == 1) selectedMapTypeId = google.maps.MapTypeId.ROADMAP;
            if (this._selectedMapType == 2) selectedMapTypeId = google.maps.MapTypeId.SATELLITE;
            if (this._selectedMapType == 4) selectedMapTypeId = google.maps.MapTypeId.HYBRID;
            if (this._selectedMapType == 8) selectedMapTypeId = google.maps.MapTypeId.TERRAIN;
            var myOptions = {
                zoom: 15,
                center: latlng,
                mapTypeId: selectedMapTypeId,
                mapTypeControlOptions: { mapTypeIds: mapTypeIds }
            };
            this._mapObject = new google.maps.Map(this._mapContainer, myOptions);

            var marker = new google.maps.Marker({
                position: latlng,
                map: this._mapObject,
                title: ""
            });
        }
    },

    dispose: function() {
    }
}
Feratel.Website.Tosc.GMapPosition.registerClass('Feratel.Website.Tosc.GMapPosition', null, Sys.IDisposable);

// Notify ScriptManager that this is the end of the script.
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
