// 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.LinkButton WebControl class
   --------------------------------------------------------------------------- */
Gaia.LinkButton = Class.create();

// Inheriting from WebControl
Object.extend(Gaia.LinkButton.prototype, Gaia.WebControl.prototype);
Object.extend(Gaia.LinkButton.prototype, Gaia.ButtonControl.prototype);

// Adding custom parts
Object.extend(Gaia.LinkButton.prototype, {

  // "Constructor"
  initialize: function(element, options){
    this.initializeLinkButton(element, options);
  },

  initializeLinkButton: function(element, options){
    // Calling base class constructor
    this.initializeWebControl(element, options);

    // we keep this one to make it possible to create Gaia solutions for browser with no JavaScript...??
    this.element.href = 'javascript:Prototype.emptyFunction();';
    this.initializeDefaultValidation();
  },
  
  setText: function(value) {
    this.element.update(value);
    return this;
  },
  
  _getElementPostValueEvent: function(){
    return '&__EVENTTARGET=' + this.getCallbackName() + '&__EVENTARGUMENT=' + this.options.arg;
  }
});

Gaia.LinkButton.browserFinishedLoading = true;
