function toggleMenu( $id, $link ) {

  var $id1s = String(document.getElementById('id1s').value).split(',');

  for ( var $i = 0; $i < $id1s.length; $i++ ) {
    var $submid = 'sub_' + $id1s[$i];
    var $idaid  = 'a_' + $id1s[$i];
    var $subm = document.getElementById( $submid );
    var $ida  = document.getElementById( $idaid  );
    if ( $id1s[$i] != $id ) {
      $ida.style.backgroundColor = '#72a294';
      $subm.style.display  = 'none';  // hides submenu
    }
    else {
      $ida.style.backgroundColor = '#4e6899';
      $subm.style.display  = 'block'; // draws submenu
    }
  }

  if ( $link ) {
    var $iframe = document.getElementById( 'psdetail' );
    $iframe.src = $link;
  }

  return false;
}

//------------------------------------------------------------------------------
function setMT( $a, $to ) {
  $a.href = "ma" + "il" + "t" + "o:" + $to + "@" + "pirum" + "." + "com";
  return true;
}

//------------------------------------------------------------------------------
function updateHeight( $iframe ) {

    // IE or FF
    var $doc = $iframe.contentWindow || $iframe.contentDocument;
    if ($doc.document) {
      $doc = $doc.document;
    }

    var $height = $doc.body.scrollHeight;
    if ( $height < 500 ) {
      $height = 500;
    }
    $iframe.style.height = $height + 'px';
    $iframe.scrolling = 'no';

}

//------------------------------------------------------------------------------
function show( $page, $option, $window, $no_back ) {

  if (typeof($window) == 'undefined' ) {
    $window = 'popup';
  }

  if (typeof($no_back) == 'undefined' ) {
    $no_back = false;
  }

  // windows are always resizable and scrollable
  if ( typeof($option) == 'undefined' || $option == '') {
    $option = 'resizable,scrollbars';
  } else {
    if ( $option.indexOf('resizable') <= 0 ) {
      $option = $option + ',resizable,scrollbars';
    }
  }

  // various window.open() implementation bugs - esp for $no_back
  var $wino;

  // FF1.5 sometimes does not have top defined - bug! arghh
  if ( typeof( top.frames ) != 'undefined' ) {
    // Look for the named frame in the current window
    for ( i = 0; i < top.frames.length; i++ ) {
      if ( top.frames[i].name == $window ) {
        $wino = top.frames[i];
      }
    }
  }

  if ( typeof( $wino ) == 'undefined' ) {
    if ( typeof( $option ) == 'undefined' || $option == '' ) {
      $wino = window.open($page, $window );
    } else {
      $wino = window.open($page, $window, $option, $no_back );
    }
  } else {
    if ( $no_back ) {
      $wino.location.replace($page);
    } else {
      $wino.location = $page;
    }
  }
  $wino.focus();

  return false;
}
