/* global vars defining css classes for displaying/hiding elements
  - also the current displayed element */
var _showWindow = "window";
var _hide = "hideBlock";
var _showEmployee = "";
var _current = "";

/* returns html element with id win_. returns null if element does not exist */   
function getWindow( win_ )
{
  return document.getElementById( win_ );
}

/* closes (hides) the element given by id win_ */
function closeWindow( win_ )
{
  var win = getWindow( win_ );
  swapClass( win, _showWindow, _hide );
}
/* determines if the OBJECT win_ is currently visible */
function isOpen( win_ )
{
  if ( win_.className == _showWindow )
    return true;
  return false;
}
/* displays the employee(s) for the selected role (given by id_) in the window with id win_.
  First checks to see if the window is currently visible and displays it (if it is not visible)
  Hides (if any) currently visible employees. Displays the employees for the selected role.
  sets the current role to the value of id_ */
function showEmployee( win_, id_ )
{
  var win = getWindow( win_ );
  if ( win )
  {
    // swap css classes if window is not visible 
    if ( !isOpen( win ) )
      swapClass( win, _showWindow, _hide );
    
    // test if no employee details are showing
    if ( "" != _current )
    {
      var current = document.getElementById( _current );
      swapClass( current, _showEmployee, _hide );
    }
    var current = document.getElementById( id_ );
    swapClass( current, _showEmployee, _hide );
    _current = id_;
  }
}