/*------------------------------------------*/
/* clickabe tags (properties implementation */
/*------------------------------------------*/
/*
 * TODO: checkbox vs. radio style
 * TODO: THERE is an IE-issue: e.target.style is undefined in onclick
*/
function ClickTags(classname, sAxis, oState) {
  this.className=classname; 
  this._axis=sAxis;  			// propertyName i.e. zack:topic (not used yet)
  this._state=oState;			// oState.nature=true, ...
  this._elems=null;
  this._bgHiColor='#99ccff';	// selected BgColor
  this._bgColor='transparent';
};

ClickTags.prototype= {

  init: function(){
    this._elems=YAHOO.util.Dom.getElementsByClassName( this.className);
    for(i=0; i<this._elems.length; i++){
      var ct=this._elems[i]; 
	  var prop=ct.title;
	  if(this._state[prop]){
        ct.style.backgroundColor=this._bgHiColor;
        ct.style.color='black';
	  }
      YAHOO.util.Event.on(ct, 'click', this.onClick, this, this);
	}
  },
  
  onClick: function(e){
  	  
    var ct=e.target; var prop=ct.title;
    if(this._state[prop]){
      ct.style.backgroundColor=this._bgColor;
      ct.style.color='black';
      this._state[prop]=false;
    }
    else {
      ct.style.backgroundColor=this._bgHiColor;
      ct.style.color='black';
      this._state[prop]=true;
    }
  },
  
  getState: function(){
    return this._state;
  }
}