//******** all.js - http://www.newdy.de - (c) hehasume - 2005 ********//

// OPEN NEW WINDOW //

function fenster(x) 
 {  
  eins = window.open(x,'wina','copyhistory=0,location=0,directories=0,scrollbars=1,resizable=1,status=0,toolbar=0,titlebar=0,menubar=0,width=400,height=600,top=60,left=400') 
 } 

function takeTag(x) 
 {  
  opener.document.myform.tag.value = x
  opener.focus()
  self.close()
 } 

function bkm() 
 {  
  var url = "http://www.newdy.de/"  
  var who = "newdy-tag-cloud"  
  var ver = navigator.appName  
  var num = parseInt(navigator.appVersion)  
  if ((ver == "Microsoft Internet Explorer")&&(num >= 4))
   {
    window.external.AddFavorite(url,who)   
   }  
  else   
   {    
    alert('Mozilla-Nutzer: \nBitte druecken Sie gleichzeitig die Tasten [Strg] + [D] \num ein Lesezeichen auf diese Seite zu setzen.')   
   } 
 }   

function shp() 
 {  
  var ver = navigator.appName  
  var num = parseInt(navigator.appVersion)  
  if ((ver == "Microsoft Internet Explorer")&&(num >= 4))
   {    
    oHomePage.setHomePage('http://www.newdy.de/')   
   }  
  else   
   {    
    alert('Mozilla-Nutzer: \nBitte richten Sie newdy.de als Startseite ein.')   
   } 
 }
 
// CHECK TAG //

 function tagCheck() 
  {  
   var check = 0
   var i = 0
   
   while (i < t.length)
    {
     //test alert(t[i])
     if(document.myform.tag.value == t[i])
      {
       i = t.length
       check = 1
       //test alert('tag gleich!')
      }
     else
      {
       i++
      }
    }

 if(check == 0)
  {
   if(confirm('Verwende - WENN MÖGLICH - einen bestehenden tag !\n\nWillst du den tag aber so beibehalten, klicke auf \"Abbrechen\"'))
    {
     document.myform.tag.focus()
    }
   else
    {
     if(document.myform.tag.value.indexOf(" ",0)!=-1) 
      {
       if(confirm('Besser du verwendest NUR EIN EINZELNES bezeichnendes Wort !\n\nWillst du den tag aber so beibehalten, klicke auf \"Abbrechen\"'))
        {
         document.myform.tag.focus()
        }
       else
        {
         document.myform.email.focus()
        }
      }
    else 
     {
      return
     }
   }
  }
 }
 
 function takeValue()
  {
   document.myform.snumber.value=document.myform.srandom.value
  }
  
  /* Find In Page Script-By Mike Hall (MHall75819@aol.com) */
  
  var NS4 = (document.layers); // Which browser?
  var IE4 = (document.all);
  
  var win = window; // window to search.
  var n = 0;
  
  function findInPage(str) {
  
  var txt, i, found;
  
  if (str == "")
  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 found, rewind
  // back to the first match.
  
  if (!win.find(str))
  while(win.find(str, false, true))
  n++;
  else
  n++;
  
  // If not found in either direction, give message.
  
  if (n == 0)
  alert(str + " nicht gefunden.");
  }
  
  if (IE4) {
  txt = win.document.body.createTextRange();
  
  // Find the nth match from the top of the page.
  
  for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
  txt.moveStart("character", 1);
  txt.moveEnd("textedit");
  }
  
  // If found, mark it and scroll it into view.
  
  if (found) {
//  txt.moveStart("character", -1);
//    txt.findText(str);
//    txt.select();
//    txt.scrollIntoView();
//    n++;
//    alert("tag/"+str);
      top.location = "tag/"+str;
  }
  
  // Otherwise, start over at the top of the page and find first match.
  
  else {
  if (n > 0) {
  n = 0;
  findInPage(str);
  }
  
  // Not found anywhere, give message.
  
  else
  alert(str + " nicht gefunden.");
  }
  }
  
  return false;
  }
