// 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.Button WebControl class
   --------------------------------------------------------------------------- */
Gaia.Button = Class.create();

Object.extend(Gaia.Button.prototype, Gaia.WebControl.prototype);
Object.extend(Gaia.Button.prototype, Gaia.ButtonControl.prototype);
Object.extend(Gaia.Button.prototype, {

  // "Constructor"
  initialize: function(element, options){
    this.initializeButton(element, options);
  },

  initializeButton: function(element, options){
    // Calling base class constructor
    this.initializeWebControl(element, options);
    this.initializeDefaultValidation();
  },
  
  _getElementPostValueEvent: function(){
    var callbackName = this.getCallbackName();
    if (callbackName !== this.element.name)
        return '&__EVENTTARGET=' + callbackName + '&__EVENTARGUMENT=' + this.options.arg;
    else
        return '&' + callbackName + '=' + $F(this.element.id);
  }
});

Gaia.Button.browserFinishedLoading = true;
