// Gaia Ajax Copyright (C) 2008 - 2009 Gaiaware AS. details at http://gaiaware.net/

/* 
 * Gaia Ajax - Ajax Control Library for ASP.NET
 * Copyright (C) 2008 - 2009 Gaiaware AS
 * All rights reserved.
 * This program is distributed under either GPL version 3 
 * as published by the Free Software Foundation or the
 * Gaia Commercial License version 1 as published by
 * Gaiaware AS
 * read the details at http://gaiaware.net
 */

/* ---------------------------------------------------------------------------
   Class basically wrapping the ASP.DropDownList WebControl class
   --------------------------------------------------------------------------- */
Gaia.DropDownList = Class.create();


// Inheriting from WebControl
Object.extend(Gaia.DropDownList.prototype, Gaia.WebControl.prototype);

// Inheriting from ListControl
Object.extend(Gaia.DropDownList.prototype, Gaia.ListControl.prototype);

// Adding custom parts
Object.extend(Gaia.DropDownList.prototype, {

  // "Constructor"
  initialize: function(element, options){
    this.initializeDropDownList(element, options);
  },


  initializeDropDownList: function(element, options){
    // Calling base class constructor
    this.initializeWebControl(element, options);
  },


  // Sets the tabindex of the control
  setTabIndex: function(value){
    this.element.tabIndex = value;
    return this;
  },

  _getElementPostValue: function(){
    return '&' + this.getCallbackName() + '=' + $F(this.element.id);
  },


  _getElementPostValueEvent: function(){
    return this._getElementPostValue() + '&__EVENTTARGET=' + this.getCallbackName();
  }
});

Gaia.DropDownList.browserFinishedLoading = true;
