/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *  Copyright (c) 2002-6  Peter Heinrich
 *  All Rights Reserved
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */



/**
 *  Make sure this page isn't trapped in someone else's frame.
 */
if( top != self )
   top.location.replace( location.href );



/**
 *  Find an object in the DOM tree, regardless of which DOM is supported by the
 *  current browser (with the exception of Netscape 4).
 */
function getObject( id )
{
   var object = null;

   if( document.getElementById )
      object = document.getElementById( id );    
   else if( document.all )
      object = document.all[ id ];
   else if( document.layers )
      object = document.layers[ id ]; 

   return( object );
}



/**
 *  Return the style portion of an object from the DOM tree.
 */
function getStyle( id )
{
   var style = getObject( id );

   if( null != style && null != style.style )
      style = style.style;

   return( style );
}


/**
 *  Change the image associated with an element in the current document.
 */
function swapImage( id, imageURL )
{
   var element = getObject( id );

   if( null != element )
      element.src = imageURL;      
}


/**
 *  Change the display style of an element, usually to toggle between its usual
 *  state ('block' or 'inline') and 'none' (to make it invisible).
 */
function setDisplay( id, value )
{
   var style = getStyle( id );

   if( null != style )
      style.display = value;
}


/**
 *  Sets the class associated with an object.
 */
function setClass( id, value )
{
  var element = getObject( id );

  if( null != element )
    element.className = value;
}


/**
 *  Open a URL in a separate browser window.  Javascript is only required when
 *  using strict HTML, since that variant doesn't employ the 'target' attribute
 *  on elements.
 */
function opennew( url )
{
   newwindow = window.open( url, '_blank', 'location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes' );

   if( window.focus )
     newwindow.focus();
}
