/**
 * @author Keith Lo keith.lo@wwwins.com
 */

/**
 * CardPanel is an abstract class to represent any panel display objects on the page 
 * @constructor
 */
CardPanel = function() {    
  /**
   *  @type object
   */
   this.cards = new Array();
}

CardPanel.prototype = {  
  /**
   * Show one card, hide all others
   * @param {Element} ele  Tab
   */
	show : function(ele)  {
		for (var i=0; i<this.cards.length; i++) {
			if (this.cards[i].tab == ele) {
				//this.cards[i].tab.style.color = '#000';
				addClassName(this.cards[i].tab, 'on');
				this.cards[i].body.style.display = 'block';
			} else {
				//this.cards[i].tab.style.color = '#fff';
				removeClassName(this.cards[i].tab, 'on');
				this.cards[i].body.style.display = 'none';
			}
		}
	}, 
  /**
   * Add an element as a card
   * @param {Object} o A JSON object:  'tab': element, 'body': element
   */
	add : function(o)  {
		this.cards.push(new Card(o));
	}
	
}

/**
 * Card is an abstract class to represent any panel display objects on the page 
 * @constructor
   * @param {Object} o A JSON object:  'tab': element, 'body': element
 */
Card = function(o) {    
  /**
   *  @type object
   */
   this.tab = o.tab;
   this.body = o.body;
}

