var selectedDiv;

function toggleLayer (topDivID, elemID, show){
  hideAll(topDivID);
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( elemID );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[elemID];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[elemID];
  vis = elem.style;
  if(show){
	vis.display = 'block';
  } else{
  	vis.display = 'none';
  	showDiv(topDivID,selectedDiv);
  }
}

function showDiv (topDivID, elemID ){
  hideAll(topDivID);
  selectedDiv = elemID;
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( elemID );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[elemID];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[elemID];
  vis = elem.style;
  vis.display = 'block';
}

function hideAll( elemID){
if(elemID == null){
return;
}
  var elem, vis, el;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( elemID );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[elemID];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[elemID];
    
  for( var x = 0; x < elem.childNodes.length; x++ ) {
  	// make sure we have an element node (1 = ELEMENT_NODE;  2 = ATTRIBUTE_NODE;  3 = TEXT_NODE)
  	if(elem.childNodes[x].nodeType == 1){
  		el = elem.childNodes[x];
  		//alert(el.innerHtml);
  		vis = el.style;
		vis.display = 'none';

  	}
  }
}



function toggleDivOL( elemID )
{
	var elem = document.getElementById( elemID );
	if( elem.style.position != 'absolute' )
	{
		elem.style.position = 'absolute';
		elem.style.left = '-4000px';
	}
	else
	{
		elem.style.position = 'relative';
		elem.style.left = '0px';
	}
}
