  var boxObjects = new Array(); //box objects from CMS 
  var restoreTimer; //timer to restore HL box
  var b; //reference to hightlightbox
  var register_done = false;
  
  function registerBox(id){
  	var el = new HLBox(id);
	boxObjects[id] = el;
  }
  
  //register DHTML elements	
  function doRegister() {		
  	  if (register_done) return;
  	  
	  b = new HLBox("highlightbox");
	  //b = new HLBox("tdefault");
	  registerBox("data");
	  registerBox("comm");  
	  registerBox("crea");    
	  registerBox("tec");      
	  registerBox("cons");      
	  register_done = true;  
	  
  }
  
  
  //show box content from id 	
  function goBox(id){
  	 try{
	  	doRegister(); //register dhtml elements
	 	b.setContent(boxObjects[id].getContent());
		clearTimer();
	 }catch(e){
	 	log("goBox(" + id + "): " + e.description);
	 }
  }
  
  //----------
  function clearTimer1(){}
  
  //-----------------
  function clearTimer(){
		if (restoreTimer)
			window.clearTimeout(restoreTimer);  	
  }
  
  //------------------------------
  function restoreBox(){
  	try {
  		restoreTimer = window.setTimeout("if(b) b.recoverContent();",200);
		//if(b) b.recoverContent();  		
  	}catch(e){
	 	log("restoreBox(): " + e.description);
	}
  }
    
  //######################################
  function HLBox(id){
  	this._id = id; //if of HLbox
	this._hlBoxel; //object HLbox <div>
	this._originHLText; //origin innerHTML of Box
	
	this.getContent = getContent;
	this.setContent = setContent;
	this.recoverContent = recoverContent;
	this.getBoxEl = getBoxEl;	
	
	//------------####### show original content
	function recoverContent(){
		try{
			if(!this.recovered) {
				this.getBoxEl().innerHTML = this._originHLText;
				this.recovered = true;
			}
		}catch(e){
			log("recoverContent " + e.description);			 
		}
	}
	
	//------------####### get content from box
	function getContent(){
		try{
			return this.getBoxEl().innerHTML;
		}catch(e){
			log("getContent " + e.description);			 
		}
	}
	
	//------------####### write content into box
	function setContent(s){
		try{
			if (!this._originHLText) this._originHLText = this.getBoxEl().innerHTML; //first call, backup original content
			this.getBoxEl().innerHTML = s;
			this.recovered = false;
		}catch(e){
			log("setContent " + e.description);			 
		}		
	}
	
	//######################
	function getBoxEl(){
		try{			
			if (!this._hlBoxel){
				this._hlBoxel = document.getElementById(this._id);
			}	
		}catch(e){
			log("getBoxEl: " + e.description);
		}
		return this._hlBoxel;
	}	  
  }
  function getLinkById(nr) {
  	try {
	  	var el = document.getElementById('rightMenu');
	  	var pEl = el.childNodes[nr];
  		return pEl.firstChild.getAttribute('href');
  	}catch(e){
		log("getBoxEl: " + e.description);
	}

  }
  function go2Url(el, nr) {
  	el.setAttribute('href', getLinkById(nr));
  }