﻿Type.registerNamespace('DDTI.Web.Map.Toolbox');

DDTI.Web.Map.Toolbox.DTPrintControl = function(element) { 
    DDTI.Web.Map.Toolbox.DTPrintControl.initializeBase(this, [element]);
    this._navigateUrl = null;
}

DDTI.Web.Map.Toolbox.DTPrintControl.prototype = {
    initialize : function() {
        DDTI.Web.Map.Toolbox.DTPrintControl.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.DTPrintControl.callBaseMethod(this, 'dispose');
    },

    _onClick : function(e) {
        DDTI.Web.Map.Toolbox.DTToolboxComponent.prototype.set_activeTool(DDTI.Web.Map.Toolbox.DTToolTypes.Print);
        location.assign(this._navigateUrl);
    },
    
    get_navigateUrl : function() {
        return this._navigateUrl;
    },
    
    set_navigateUrl : function(value) {
        if (this._navigateUrl !== value) {
            this._navigateUrl = value;
            this.raisePropertyChanged('navigateUrl');
        }
    }
}

DDTI.Web.Map.Toolbox.DTPrintControl.registerClass('DDTI.Web.Map.Toolbox.DTPrintControl', Sys.UI.Control);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();