// JavaScript Document

function toggleLayer(whichLayer) {
  var elem, vis;

  elem = getElementById(whichLayer);

  if (elem != null) {
	  vis = elem.style;
	  // if the style.display value is blank we try to figure it out here
	  if (vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined) {
		  vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
	  }

	  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  }

}

function showPanel(parent_id, id) {
	var parent = getElementById(parent_id);
	var i=-1;
	while (++i < parent.childNodes.length) {
		child = parent.childNodes[i];
		if (child.id == id) {
			child.style.display = 'block';
		} else if (child.nodeName.toLowerCase() == "div" && child.id.toLowerCase().substring(0,5) == 'panel') {
			child.style.display = 'none';			
		}
	}
}


function getElementById(id) {
	var element;

	if(document.getElementById) {
		// this is the way the standards work
		element = document.getElementById(id);
	} else if (document.all) {
		// this is the way old msie versions work
		element = document.all[id];
	} else if (document.layers) {
		// this is the way nn4 works
		element = document.layers[id];
	}

	return element;
}
