// global variables
var _d = document;




/*
 * class PeopleBlock
 */ 

  // constructor
  function PeopleBlock(_PBactiveID, _PBamount) {
    // properties
    this._PBactiveID = _PBactiveID;
    this._PBamount = _PBamount;
    this._PBtxtSuffix = 'txt';
    this._PBclsLnkL = 'cn_pplFrameL';
    this._PBclsLnkH = 'cn_pplFrameH';    
    this._PBclsTxtOn = 'cn_pplTxtOn';
    this._PBclsTxtOff = 'cn_pplTxtOff';        
    this._PBactiveRef = null;
    this._PBactiveRefTxt = null;    
    this._PBoverRef = null;    
    
    // external methods	
    this.setActive = setActive;
    this.setStatusOver = setStatusOver;
    this.setStatusOut = setStatusOut; 
    this.nextActive = nextActive;       
    this.previousActive = previousActive;    
    
    // internal methods
    this.getRef = getRef;
    this.setActiveRef = setActiveRef;
  }
  
  // method setActive
  function setActive(_PBref) {
    if(this._PBactiveRef.id != _PBref.id) {
      this._PBactiveRef.className = this._PBclsLnkL;
      this._PBactiveRefTxt.className = this._PBclsTxtOff;
      
      this._PBactiveID = _PBref.id;
      this.setActiveRef();
      this._PBactiveRef.className = this._PBclsLnkH;
      this._PBactiveRefTxt.className = this._PBclsTxtOn;
    }  
    
    return false;    		
  }
  
  // method setStatusOver
  function setStatusOver(_PBref) {
    if(this._PBactiveRef == null) this.setActiveRef();
    	
    if(_PBref.id != this._PBactiveRef.id) {	
      _PBref.className = this._PBclsLnkH;
      this._PBoverRef = _PBref;	
    }
    
    return false;  
  }
  
  // method setStatusOut
  function setStatusOut() {
    if(this._PBoverRef != null && this._PBoverRef.id != this._PBactiveRef.id) {	
      this._PBoverRef.className = this._PBclsLnkL;
      this._PBoverRef = null;
    }  
    
    return false;     	
  }  
  
  // method nextActive
  function nextActive() {
    if(this._PBactiveRef == null) this.setActiveRef();    

    var actData = this._PBactiveID.split('_');
    var actNr = parseInt(actData[1]);
    
    if(actNr == this._PBamount) actNr = 1;
    else actNr++;
    
    this.setActive(this.getRef(actData[0] + '_' + actNr));
            	
    return false;		
  }
  
  // method previousActive
  function previousActive() {
    if(this._PBactiveRef == null) this.setActiveRef();

    var actData = this._PBactiveID.split('_');
    var actNr = parseInt(actData[1]);
    
    if(actNr == 1) actNr = this._PBamount;
    else actNr--;
    
    this.setActive(this.getRef(actData[0] + '_' + actNr));
          	
    return false;  	
  }  
  
  // method getRef
  function getRef(_PBele) {
    if(_d.getElementById) return _d.getElementById(_PBele);
    if(_d.all) return _d.all[_PBele];
    
    return false;  	
  } 
  
  // method setActiveRef
  function setActiveRef() {
    this._PBactiveRef = this.getRef(this._PBactiveID);
    this._PBactiveRefTxt = this.getRef(this._PBactiveID + this._PBtxtSuffix);	
    
    return true;  	
  }       