/*       titel:  JavaScript Frame-Page-Controlling          */


function CheckFrame( )
{
  if ( top.frames.length <= 0 )
    LoadIndexPage( );    /* Aktuelle Seite ist nicht im Frame */
 }

function LoadIndexPage( )
{
  /* Wenn die Webseite ohne Frame gestartet wird, den Frame nachladen. */
  /* (Dies kann zur Endlos-Schleife führen, wenn der Browser JAVA aber keine Frames kann) */
  
  theURL = top.location.href;

  /* find filename in URL */
  
  theStartIndex = theURL.lastIndexOf(".htm");
    
  if ( theStartIndex > 0 )
  {
    theEndIndex     = theStartIndex;
   
    for( theIndex = theStartIndex; theIndex >= 0; theIndex-- )
    {
      theChar = theURL.charAt( theIndex );
      if ( theChar == "/" || theChar == "\\" )
      {
        theStartIndex = theIndex + 1;
        break;
      }
    };
    
    if ( theStartIndex != theEndIndex )
    {
        theIndexName = "index.html";

        /* Reload der  index.html */
      
        theNewURL = theURL.substring( 0, theStartIndex ) + theIndexName + theURL.substring( theEndIndex + 5, theURL.length );
        top.location.href = theNewURL;
        
        /* Aufgabe: der Index sollte RELOADed werden... evtl. mit # oder ? */
      }
    /* else ... nix machen! */
  }
}

/* Ende des Scriptes */
