/* 
 * Gaia Ajax Widgets, an Ajax Widget Library for ASP.NET 2.0
 * Copyright (C) 2007  Frost Innovation AS
 * All rights reserved.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as 
 * published by the Free Software Foundation.
 * 
 * Or if you have purchased the "Professional Edition" from Frost Innovation
 * it is distributed to you in person under the Gaia Commercial License
 * which makes it possible for you to create closed source applications
 * and still be able to distribute those applications without creating 
 * restrictions for your source code.
 * 
 * Unless you're developing GPL software you should and probably legally
 * have to purchase a license of the Gaia Commercial License since otherwise
 * you might be forced to GPL license your derived works.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should find a copy of both the GPL version 2 and the 
 * Gaia Commercial License on disc where you have extracted these files.
 * If not visit http://www.gnu.org for the GPL version or 
 * http://ajaxwidgets.com for the Gaia Commercial License.
 * 
 * Breaking the terms of whatever license you're entitled to use will cause
 * prosecution by Frost Innovation AS. If possible we will demand to settle any 
 * law suits at a court in Norway.
 * 
 */




/* ---------------------------------------------------------------------------
   Class basically wrapping the ASP.Panel WebControl class
   --------------------------------------------------------------------------- */
WebControl.Panel = function(element, options){
  this.initialize(element, options);
}

WebControl.Panel.prototype = Object.extend(new WebControl(), Object.extend(new WebControl.Container(), {

  // "Constructor"
  initialize: function(element, options){
    // Calling base class constructor
    this.baseInitializeWebControl(element, options);
  },

  // Sets the tabindex of the button
  setTabIndex: function(value){
    this.element.tabIndex = value;
    return this;
  },

  setVisible: function(value){
    value ? Element.show(this.element) : Element.hide(this.element);
    if( value != true ){

      // Making sure control and child controls is destroyed...
      this.destroy();
    }
    return this;
  },

  destroy: function(){
    // Destroying all CHILDREN controls
    this.destroyChildrenControls();

    // Calling Object.destroy implementation...
    this._destroyImpl();
  },

  _getElementPostValue: function(){
    return '';
  }
}));

