﻿/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("hiscall");

hiscall.DropDownJumpList_Behavior = function(element) {
    hiscall.DropDownJumpList_Behavior.initializeBase(this, [element]);
    
    this._defaultValue;
}

hiscall.DropDownJumpList_Behavior.prototype = {
    get_defaultValue: function()
    {
        return this._defaultValue;
    },
    set_defaultValue: function(value)
    {
        this._defaultValue = value;
    },
    
    initialize: function() {
        hiscall.DropDownJumpList_Behavior.callBaseMethod(this, 'initialize');
        
        var OnChangeHandler = Function.createDelegate(this, this._OnChange);
        
        $addHandler(this.get_element(), "change", OnChangeHandler);
        
        // Add custom initialization here
    },
    dispose: function() {        
        $clearHandlers(this.get_element());
    
        //Add custom dispose actions here
        hiscall.DropDownJumpList_Behavior.callBaseMethod(this, 'dispose');
    },
    _OnChange: function()
    {
        var select = this.get_element();
        
        if(select.options[select.selectedIndex].value != this._defaultValue)
        {
            document.location.href = select.options[select.selectedIndex].value;  
        }
    }
}
hiscall.DropDownJumpList_Behavior.registerClass('hiscall.DropDownJumpList_Behavior', Sys.UI.Behavior);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
