﻿Type.registerNamespace('DDTI.Web.Map.Toolbox');

DDTI.Web.Map.Toolbox.DTFullExtentControl = function(element) { 
    DDTI.Web.Map.Toolbox.DTFullExtentControl.initializeBase(this, [element]);
}

DDTI.Web.Map.Toolbox.DTFullExtentControl.prototype = {
    initialize : function() {
        DDTI.Web.Map.Toolbox.DTFullExtentControl.callBaseMethod(this, 'initialize');
        this._onclickHandler = Function.createDelegate(this, this._onClick);
        $addHandlers ( this.get_element(), { 'click' : this._onClick }, this );
    },

    dispose : function() {
        $clearHandlers(this.get_element());
        DDTI.Web.Map.Toolbox.DTFullExtentControl.callBaseMethod(this, 'dispose');
    },

    _onClick : function(e) {
        DDTI.Web.Map.Toolbox.DTToolboxComponent.prototype.set_activeTool(DDTI.Web.Map.Toolbox.DTToolTypes.FullExtent);
        var w = DDTI.Web.Map.Viewer.DTViewerComponent.prototype.get_width();
        var h = DDTI.Web.Map.Viewer.DTViewerComponent.prototype.get_height();
        DDTI.Web.Map.Viewer.DTViewerComponent.prototype.set_imageUrl('Default.mapx?Todo=FullExtent&Width=' + w + '&Height=' + h + '&Random=' + Math.floor(Math.random()*1000000));
    }
}

DDTI.Web.Map.Toolbox.DTFullExtentControl.registerClass('DDTI.Web.Map.Toolbox.DTFullExtentControl', Sys.UI.Control);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();