////////////////////////////
// Knito
//                  |||
// Peter Klauer    \. ./
// Knito@knito.de  - ^ -
//                 / - \
// Dezember 1999    |||
//
////////////////////////////

// 10. Dez. 2000 : placeFocus() von www.knito.de hierhergeholt
// 14. Nov. 2000 : Mini-Bug(?) im Netscape plaziert Zeichenerklärung außerhalb
// der Reihe. Writeln() in Write() geändert und der "Fehler" ist weg.
// 20. Okt. 2000 : Babelfish u. AddmeToFavorites() in UpdateNotice()
// 25. Jul. 2000 : framebreaker bricht aus Frames aus.
// 23. Jul. 2000 : LaunchViewer eingebaut zum Bildergucken
// 22. Jul. 2000 : Menü geändert
// 05. Feb. 2000 : WriteIndex() geändert: window.status funktioniert
// 01. Jan. 2000 : W3C-Knopf zum schnellen Check in UpdateNotice() eingebaut
// 21. Dez. 2001 : setPointer() aus phpMyAdmin übernommen


// Funktionen für die Statusleiste
//
function StatusGoBack(){ window.status="Zurück"; return true; };
function StatusGoFore(){ window.status="Vorwärts"; return true;};
function StatusNull(){ window.status=""; return true;};
function MyGoBack(){ history.go(-1); };

//
// Ein Hilfefenster öffnen
//
function AnotherWindow(whaturl)
{
  //
  // Abgeguckt bei www.iwz.de/os/suchen.html
  self.name="Hilfe";
  window.open(
   whaturl,
    'AnotherOne',
    'scrollbars=yes,resizable=yes,width=640,height=300,toolbar=no,location=no');
} // Ende von AnotherWindow   

//
// Standard-Zeichenerklärung für UpdateNotice
//
function HelpWindow()
{
  self.name="Hilfe";
  window.open(
    'hlp_zchn.html',
    'HelpWindow',
    'scrollbars=no,resizable=yes,width=360,height=420,toolbar=no,location=no');
    //window.focus("hlp_zchn.html");
} // Ende von HelpWindow   


//
// UpdateNotice(). "wanndenn" ist der ausgebende "geändert-am-Datums-Text."
// Falls eine "wasdenn"-Datei angegeben ist, wird ein Hilfe-Knopf eingeblendet,
// der dann diese Datei beim Anklicken in ein neues Fenster lädt.
//
function UpdateNotice(wanndenn, wasdenn)
{
  document.open;
  document.write('<table summary="" border="0" width="100%"><tr valign="middle"><td valign="middle">');
  //
  // lastModified kommt aus der aufrufenden Datei!
  // NetScape-Kompatibel nur dann, wenn als Text uebergeben.
  //
  document.write('Letztes Update am&nbsp;'+wanndenn);
  document.write('</td><td bgcolor="#008400" class="border" align="right" width=380  valign="middle">'); 
  document.write('<a style:font-size=-2 href="mailto:knito@knito.de?subject=Homepage">');
  document.write('<img src="images/brief.png" border=0 alt="e-m@il an\nknito@knito.de"></a>&nbsp;');
  
	AddMeToFavorites();
	
  document.write(
   '<A href="http://pub49.bravenet.com/guestbook/show.asp?usernum=4171929792&cpv=1"'+
   ' target="_blank"><img src="images/book.gif" border=0 alt="G&auml;stebuch"></A>&nbsp;');

  document.write('<a href="test.php3"><img src="images/php.gif" border=0 alt="PHP info"></a>&nbsp;');
 
  document.write('<a onClick="JavaScript:HelpWindow();return true;" >');
  document.write('<img style="cursor:hand" src="images/help.gif" alt="Zeichenerkl&auml;rung" border="0" '+
    'width="64" height="31" ></a>&nbsp;');
    
  document.write('<a href="http://babel.altavista.com/translate.dyn?lin=de&translate_me=yes&bblType=url&lp=de_en&url='+escape(document.location)+'">');
  document.write('<img src="images/bfish.gif" alt="Translation with BabelFish" border="0"></a>&nbsp;');
  
  document.write('<a href="linkcheck.php3?url='+escape(document.location)+
    '" style="text-decoration:none;font-size:12px;font-weight:bold;color:rgb(255,255,255);" title="Check Page Links">L</a>&nbsp;');  
  
  document.write('<a href="http://validator.w3.org/check/referer?uri='+escape(document.location)+'" target="_blank">');
  document.write('<IMG src="images/w3cvalid.gif" width="88" height="31" '+
    'alt="aktuelle Seite testen" border="0"></a>');

  document.write('</td></tr></table>');
  document.close;
 
} // Ende von UpdateNotice()

// Zeige Bild, benötigt viewer.html. 
function launchViewer(bildurl,bildtext,bildtitel)
{ 
  window.imagename=bildurl;
  window.imagetext=bildtext;
  window.imagetitle=bildtitel;
  
  viewer=window.open('viewer.html','VIEWER','scrollbars,status,resizable');
  viewer.opener=window;
  viewer.focus();
  return false;
} // Ende von launchViewer()

// "Gefange" Seite befreit sich selbst. Bravenet Webmaster Tip v. 25.7.2000
// Bildchen ist von mir selber...
function framebreaker()
{
  if (top.frames.length != 0)
  {
    document.write('<a href="'+self.document.location+'" target="_top">'+
      '<img src="images/breakout.gif" border=0 alt="BREAK THE FRAME!!"></a>');
  } 
} // Ende von framebreaker()


function AddMeToFavorites()
{
 if ((navigator.appVersion.indexOf("MSIE") > 0)
     && (parseInt(navigator.appVersion) >= 4)) {
     document.write("<SPAN STYLE='color:blue;cursor:hand;"+
		 "'onclick='window.external.AddFavorite(location.href, document.title);'>"+
		 "<img src='images/plus.gif' border=0 width=20 height=20 "+
		 "alt='Diese Seite zu den Favoriten hinzuf&uuml;gen'></SPAN>");
 }
}

function placeFocus() 
{
 var i;
 
 if (document.forms.length > 0) 
 {
 	var field = document.forms[0];
	for (i = 0; i < field.length; i++) 
	{
	 if ((field.elements[i].type == "text") || 
	 		(field.elements[i].type == "textarea") || 
			(field.elements[i].type.toString().charAt(0) == "s")) 
	 {
	 	document.forms[0].elements[i].focus();
		break;
   }
  }
 }
}

function AlertBieterOnly()
{
    alert( 'Sie müssen angemeldet sein, um diese Funktion zu nutzen.' );
}

/**
 * Sets/unsets the pointer in browse mode
 *
 * @param   object   the table row
 * @param   object   the color to use for this row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, thePointerColor, theTextColor)
{
  var theCells;
  
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = thePointerColor;
        theCells[c].style.color = theTextColor;        
    }

    return true;
} // end of the 'setPointer()' function
 
