/* - suchInSeite.js ----------------------------------------------------------- */

 /*
Find In Page Script-
By Mike Hall (MHall75819@aol.com)
*/

var NS4 = (document.layers);    // Which browser?
var IE4 = (document.all);

var currentWindow = window;    // window to search.
var nSS   = 0;

function findInPage( pStr )
{
 var textTreffer, ii, wasGefunden;

 if  (pStr == "")return false;

 // Find next occurance of the given string on the page, wrap around to the
 // start of the page if necessary.

 if  (NS4)
     {// Look for match starting at the current point. If not wasGefunden, rewind
      // back to the first match.
      if  (!currentWindow.find(pStr))
           while(currentWindow.find(pStr, false, true))nSS++;
      else nSS++;
      // If not wasGefunden in either direction, give message.
      if  (n == 0)alert("Nichts gefunden.");
     }
 if  (IE4)
     {textTreffer = currentWindow.document.body.createTextRange();
      // Find the nth match from the top of the page.
      for( ii = 0;   ii <= nSS  &&  (wasGefunden = textTreffer.findText(pStr)) != false;   ii++ )
         {textTreffer.moveStart("character", 1);
          textTreffer.moveEnd("textedit");
         }
      // If wasGefunden, mark it and scroll it into view.
      if  (wasGefunden)
          {textTreffer.moveStart("character", -1);
           textTreffer.findText(pStr);
           textTreffer.select();
           textTreffer.scrollIntoView();
           nSS++;
          }
      // Otherwise, start over at the top of the page and find first match.
      else{if  (nSS > 0)
               {nSS = 0;
                findInPage(pStr);
               }
           // Not wasGefunden anywhere, give message.
           else alert("Nichts gefunden.");
          }
     }
 return false;
}

/* ----------------------------------------------------------- suchInSeite.js - */
