/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
behaviours.js 
*/

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
functions
*/
function showEntry(dest, index) {
	// init: set every link inactive (by destination)
	initEntry(dest);
	// set index class > active
	// navpoint:
	entry = document.getElementById('nav_'+dest+'_'+index);
	if (entry) entry.className = dest+'_active';
	// content:
	entrycontent = document.getElementById(dest+'_'+index);
	if (entrycontent) entrycontent.style.display = "block";
}
function initEntry(dest) {
	// navigation: mk inactive
	var el = getElementsByClass(dest+"_active");
	for (i=0 ; i<el.length ; i++) el[i].className = dest+"_inactive";
	// hide every content
	var el = getElementsByClass(dest+"_entrycontent");
	for (i=0 ; i<el.length ; i++) el[i].style.display = "none";
}
function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if (node == null)
    node = document;
  if (tag == null)
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if (pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}


/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
calling on load
*/
window.onload = function() {
}
