/* ===============================================================================
  header_lib.js
	belenus interparts
	generate:2002.09.13
	modified:2002.09.13	
=============================================================================== */



	function setTreeLabel(label,treepath) {
		if(label != null && label != 'null' && belenusHome.currentLabel != label) {	
    
      if(!belenusHome.labelNavigation) {
  			belenusHome.currentLabel = label; // sets the variable "currentLabel" at the preferences.js
        displayLabel();
      } else {
        belenusHome.currentLabel = label;
        writeText(belenusHome.getLabelNav(treepath));
      }
			
		}
	}

	var currentShownText = ""; // current shown text....
	function displayLabel() {
		var speed = 15;
			if(belenusHome.currentLabel.length == currentShownText.length) {
				currentShownText = "";
				//do nothing
			} else {
				currentShownText += belenusHome.currentLabel.charAt(currentShownText.length);
				writeText(unescape(currentShownText));
				setTimeout("displayLabel()",speed);
			}
	}

	function writeText(text) {
			document.getElementById('cLabel').innerHTML = text;
	}


	function jumpXLevelUp(x) { 
	  if(belenusHome.currentTreePath.length >1) {
	    var newTreePath = "";
	    var divider = "/";
	    var treeIDs = belenusHome.currentTreePath.substring(1,belenusHome.currentTreePath.length).split(divider);
	    if(treeIDs.length == 2) return;
	    var jumps = 0;
	    if(parseInt(x) >= parseInt(treeIDs.length)) {
	      newTreePath = divider;
	    } else {
	      jumps = eval(treeIDs.length - x);
	      for(var i = 0; i < jumps; i++) {
	        newTreePath += divider+treeIDs[i];
	      }
	    }
	    belenusHome.sendMessage("Tree","SelectNode","ItemPath="+newTreePath);
	  }
	}
