// resize fix for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;	// holds id of currently visible layer

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function swapLayers(id,id2) {
  hideLayer(id2);
  showLayer(id);
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

// get reference to nested layer for ns4
// from old dhtmllib.js by Mike Hall of www.brainjar.com
function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i<doc.layers.length; i++) {
		theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0) 
			if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
					return theLyr;
	  }
		return null;
  }
}

function showhide(id) {
	if (document.getElementById(id).style.display =='none') {
		document.getElementById(id).style.display=''; }
	else {
		document.getElementById(id).style.display='none'; }
}

function show(id) {
	document.getElementById(id).style.display=''; 
}

function hide(id) {
	document.getElementById(id).style.display='none'; 
}

function showLayer(id) {
	document.getElementById(id).style.visibility="visible";
}
	
function hideAllLayers() {
	document.getElementById('menu1').style.visibility="hidden";
	document.getElementById('menu2').style.visibility="hidden";
}