
////////// TABswitch	

// resize fix for ns4
var origWidth, origHeight;
if (document.Tabs) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

function showTab(id) {
  var tab = getElemRefs(id);
  if (tab && tab.css) tab.className = "current";
}

function hideTab(id) {
  var tab = getElemRefs(id);
  if (tab && tab.css) tab.className = "norm";
}

var cur_tab;	// holds id of currently block Tab
function swapTabs(id) {
  // doLinkClass(lnk);
  if (cur_tab) hideTab(cur_tab);
  showTab(id);
  cur_tab = id;
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.Tabs)? gettabRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

// get reference to nested Tab for ns4
// from old dhtmllib.js by Mike Hall of www.brainjar.com
function gettabRef(tab,doc) {
	if (document.Tabs) {
		var thetab;
		for (var i=0; i<doc.Tabs.length; i++) {
	  	thetab = doc.Tabs[i];
			if (thetab.name == tab) return thetab;
			else if (thetab.document.Tabs.length > 0) 
	    	if ((thetab = gettabRef(tab,thetab.document)) != null)
					return thetab;
	  }
		return null;
  }
}

function tabinit(id) {
  var tab = getElemRefs(id);
  swapTabs(tab);
}



// BOXswitch

// resize fix for ns4
var origWidth, origHeight;
if (document.Boxes) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}


function showBox(id) {
  var box = getElemRefs(id);
  if (box && box.css) box.css.display = "block";
}

function hideBox(id) {
  var box = getElemRefs(id);
  if (box && box.css) box.css.display = "none";
}

var cur_box;	// holds id of currently block Box
function swapBoxes(id) {
  // doLinkClass(lnk);
  if (cur_box) hideBox(cur_box);
  showBox(id);
  cur_box = id;
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.Boxes)? getboxRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

// get reference to nested Box for ns4
// from old dhtmllib.js by Mike Hall of www.brainjar.com
function getboxRef(box,doc) {
	if (document.Boxes) {
		var thebox;
		for (var i=0; i<doc.Boxes.length; i++) {
	  	thebox = doc.Boxes[i];
			if (thebox.name == box) return thebox;
			else if (thebox.document.Boxes.length > 0) 
	    	if ((thebox = getboxRef(box,thebox.document)) != null)
					return thebox;
	  }
		return null;
  }
}

function boxinit(id) {
  var box = getElemRefs(id);
  swapBoxes(box);
}
