// Toggles layer visibility.
// Arguments: layerId, layerId, layerId, ...
function toggleLayer()
{
  var i, args = toggleLayer.arguments;
  for (i=0; i<args.length; i+=1)
  {
	var layerName = args[i];
	var elem;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( layerName );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[layerName];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[layerName];
	var 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';
  }
}

// Toggles layer class.
// Arguments: layerId, styleName1, stlyeName2, layerId, styleName1, styleName2, ...
function toggleClass()
{
  var i, args = toggleClass.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
	var layerName = args[i];
	var elem;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( layerName );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[layerName];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[layerName];
	var currentClassName = elem.className;
	if (currentClassName == args[i+1])
		elem.className = args[i+2];
	else if (currentClassName == args[i+2])
		elem.className = args[i+1];
  }
}