/*
---------------------------------------------------------------------------
 Copyright (C) Michael Zwanger  2002  All Rights Reserved.
---------------------------------------------------------------------------
        File: //www.zwanger.de/header.js
      Author: Michael Zwanger
Archive Date: 15-Aug-2002
    Language: JavaScript
     Project: www.zwanger.de
---------------------------------------------------------------------------*/


// Public variables
// ----------------
var ImageDir ='images' ;
var ShowReferences = true ;
var UnderConstruction = false ;
var bgColor = '#f6f6ff';
var fgColor = '#000000';

var HomeURL = '.' ;
var EMail = 'temp04nospam@Zwanger.de'  ;
var FooterIcon = '<A href="http://validator.w3.org/check?uri='
	+ document.URL
	+ '"target=_blank> <IMG alt=\"Valid HTML 4.01!\" border=0 src=\"'
	+ ImageDir + '/valid-html401.gif\"></A>' ;




// Private variables
// -----------------
var SectionCounter = 1 ;
var ScreenMode = ( window.name.search (/PrintPreview/) == -1 ) ;


//-------------------------------------------------------------------------
// Set functions
//-------------------------------------------------------------------------
function setImageDir (mydir)
{
  ImageDir = mydir ;
  FooterIcon = '<A href="http://validator.w3.org/check?uri='
	+ document.URL
	+ '"target=_blank> <IMG alt=\"Valid HTML 4.01!\" border=0 src=\"'
	+ ImageDir + '/valid-html401.gif\"></A>' ;
}
function setHomeURL(mydir)           {  HomeURL = mydir ;  }
function setEMail (mytext)           {  EMail = mytext ;  }
function setShowReferences (bool)    {  ShowReferences = bool ; }
function setUnderConstruction (bool) {  UnderConstruction = bool ; }
function setFooterIcon (string)      {  FooterIcon = string ; }
function setBgColor (string)         {  bgColor = string ; }
function setFgColor (string)         {  fgColor = string ; }


//-------------------------------------------------------------------------
function  printPreviewWindow()
//-------------------------------------------------------------------------
{
  PrintPreview = window.open(document.URL,"PrintPreview", "width=640, scrollbars=yes, menubar=yes, toolbar=yes");
}



//-------------------------------------------------------------------------
function bookmark(url, description)
//-------------------------------------------------------------------------
{
  //***---This text will be shown to the visitor if it has Netscape.
  if (navigator.appName=='Microsoft Internet Explorer'){
    window.external.AddFavorite(document.URL, document.title);
  }
  else if (navigator.appName=='Netscape') {
    netscape="First push OK and then hit CTRL+D to add a bookmark to this site:\nURL="
      + document.URL + "\nTitle=" +  document.title ;
    alert(netscape);
  }
}



//-------------------------------------------------------------------------
function  printHyperlinkURL(theURL)
//-------------------------------------------------------------------------
// Each subdirectory of theURL is displayed as an own link
{
 var theSeparator = ("/");
 if (theURL.search(/\\/) > 0)  theSeparator = ("\\");
 var Levels = theURL.split(theSeparator);
 // document.write("<br>" + theURL + ": Separator=" + theSeparator + "   levels=" + Levels.length + "search=" + theURL.search(/\\/) + "<br>");
 var myURL = Levels[0] + theSeparator ;
 for (var ii=1; ii < Levels.length; ++ii) {
   myURL += Levels[ii] ;
   if (ii<Levels.length-1) myURL += theSeparator
   if (Levels[ii].length > 0) document.write(" >> " + Levels[ii].link(myURL)) ;
 }
 document.write("<br>");
}


//-------------------------------------------------------------------------
function pageheadpre()
//-------------------------------------------------------------------------
{
  // document.writeln ("<p>Screen Navigation: " + ScreenMode  + "</p>") ;
  if (! ScreenMode) {
    bgColor = "#ffffff" ;
    fgColor = "#000000" ;
    document.fgColor = fgColor ;
    document.body.link = fgColor ;
    document.writeln ("<style type=\"text/css\">a:link{text-decoration:none}a:visited{text-decoration:none}</style>");
    document.getElementsByTagName("body")[0].bgColor ="#ffffff" ;
  }
  document.writeln ("<A name=top></A>") ;
  document.writeln ("<TABLE bgColor=" + bgColor + " fgColor=" + fgColor + " border=0 cellPadding=5 cellSpacing=0 width=\"100%\" style=\"color:" + fgColor + ";\" >") ;
  document.writeln ("  <TBODY>") ;
  document.writeln ("  <TR>") ;
  document.writeln ("    <TD class=indexbar> &nbsp; ");
}

//-------------------------------------------------------------------------
function pageheadpost()
//-------------------------------------------------------------------------
{
  document.writeln ("    </TD>") ;
  if (ScreenMode) {
    document.writeln ("    <TD align=right>") ;
    document.writeln ("	  <A href=\"" + self.location + "\" target=_top><IMG alt=\"Single frame\" border=0 src=\"" + ImageDir + "/noframes.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	  <A href=\"javascript:printPreviewWindow()\"><IMG alt=\"Print preview window\" border=0 src=\"" + ImageDir + "/printer.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	  <A href=\"javascript:bookmark()\"><IMG alt=\"Bookmark this page\" border=0 src=\"" + ImageDir + "/bookmark_add.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	  <A href=\"javascript:history.back()\"><IMG alt=\"Go back\" border=0 src=\"" + ImageDir + "/goback.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	  <A href=\"#bottom\"><IMG alt=\"Go to bottom\" border=0 src=\"" + ImageDir + "/gobottom.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	  <A href=\"" + HomeURL + "\" target=_top><IMG alt=\"Go home\" border=0 src=\"" + ImageDir + "/gohome.gif\" width=20></A> &nbsp;") ;
    document.writeln ("</TD>") ;
  }
  document.writeln ("</TR></TBODY></TABLE>") ;
}


//-------------------------------------------------------------------------
function head2pre()
//-------------------------------------------------------------------------
{
  document.writeln ("<A name=section" + SectionCounter + "></A>") ;
  document.writeln ("<TABLE bgColor=" + bgColor + " border=0 cellPadding=5 cellSpacing=0 width=\"100%\" style=\"width=100%; border-style:solid; border-width:medium; border-color:#405060; padding:0; margin-top:10mm;\">") ;
  document.writeln ("  <TR>") ;
  document.writeln ("    <TD align=left></A>") ;
}

//-------------------------------------------------------------------------
function head2post()
//-------------------------------------------------------------------------
{
  document.writeln ("    </TD>") ;
  if (ScreenMode) {
    document.writeln ("    <TD align=right width=175>") ;
    document.writeln ("      <A href=\"javascript:history.back()\"><IMG alt=\"Go back\" border=0 src=\"" + ImageDir + "/goback.gif\" width=20></A>&nbsp; ");
    document.writeln ("      <A href=\"#top\"><IMG alt=\"Go to top\" border=0 src=\"" + ImageDir + "/gotop.gif\" width=20></A>&nbsp; ");
    if (SectionCounter > 1) document.writeln ("      <A href=\"#section" + eval(SectionCounter-1) + "\"><IMG alt=\"Previous section\" border=0 src=\"" + ImageDir + "/goup.gif\" width=20></A>&nbsp; ");
    document.writeln ("      <A href=\"#section" + eval(SectionCounter+1) + "\"><IMG alt=\"Next section\" border=0 src=\"" + ImageDir + "/godown.gif\" width=20></A>&nbsp; ");
    document.writeln ("      <A href=\"#bottom\"><IMG alt=\"Go to bottom\" border=0 src=\"" + ImageDir + "/gobottom.gif\" width=20></A>&nbsp; ");
    document.writeln ("      <A href=\"" + HomeURL + "\" target=_top><IMG alt=\"Go home\" border=0 src=\"" + ImageDir + "/gohome.gif\" width=20></A>&nbsp; ");
    document.writeln ("    </TD>") ;
  }
  document.writeln ("  </TR>") ;
  document.writeln ("</TABLE>") ;
  SectionCounter++ ;
}

//-------------------------------------------------------------------------
function pagebottompre()
//-------------------------------------------------------------------------
{
  if ( document.links.length && ShowReferences ) {
    head2pre() ;
    document.writeln ("<H2 class=\"bar\">HTTP References</H2>");
    head2post() ;
    document.writeln ("<p><table cellspacing=5>");
    var lineindex=0 ;
    var lTotalLinks = document.links.length ;
    var searchexpr = document.URL ;
    searchexpr=searchexpr.replace(/^.*:\/\//,"");
    searchexpr=searchexpr.replace(/\//g,".");
    searchexpr = "/" + searchexpr + "/i" ;
       document.writeln (searchexpr);
    for(var i=0; i < lTotalLinks; ++i) {
      var result1 = String(document.links[i]).search(/http/) ;
      //var result = searchexpr.exec(document.links[i]) ;
      var result2 = String(document.links[i]).search(/\#section\d/) ;
      if ( result1 != -1 && result2 == -1 ) {
	lineindex ++ ;
	document.write("<tr><td valign=\"top\" align=\"right\">[" + lineindex + "]&nbsp;</td><td><a href=" 
		       + document.links[i] + " target=_blank>" + decodeURI(document.links[i]) + "</a></td></tr>");
      }
    }
    document.writeln ("</table></p>");
  }

  document.writeln ("<A name=bottom></A>") ;
  document.writeln ("<TABLE bgColor=" + bgColor + " border=0 cellPadding=5 cellSpacing=0 style=\"color: " + fgColor + "; BORDER-BOTTOM: #405060 thin solid; BORDER-LEFT-COLOR: #405060; BORDER-RIGHT-COLOR: #405060; BORDER-TOP: #405060 solid; MARGIN-TOP: 40px\" width=\"100%\">") ;
  document.writeln ("  <TBODY>") ;
  document.writeln ("  <TR>") ;
  document.writeln ("    <TD align=left>") ;
}


//-------------------------------------------------------------------------
function pagebottompost()
//-------------------------------------------------------------------------
{
  theDate= new Date(); 
  document.write(("<br>Downloaded: " + theDate.toLocaleString()).fontsize(2) + "<br>");
  if (UnderConstruction) {
     FooterIcon =  "<IMG alt=\"UNDER CONSTRUCTION\" border=0 src=\"" + ImageDir + "/baustelle.gif\">" ;
  }
  document.writeln ("	</TD>") ;
  document.writeln ("    <TD align=middle>") ;
//  document.writeln ("	  <A href=\"" + FooterIconLink + "\" target=_blank>") ;
//  document.writeln ("	  <IMG alt=\"" + FooterIconText + "\" border=0 src=\"" + FooterIconName + "\"" + FooterIconSize + "></A>") ;  
  if (ScreenMode) {
     document.writeln (FooterIcon) ;
  }
  document.writeln ("	</TD>") ;
  if (ScreenMode) {
    document.writeln ("    <TD align=right>") ;
    document.writeln ("	  <A href=\"javascript:history.back()\"><IMG alt=\"Go back\" border=0 src=\"" + ImageDir + "/goback.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	  <A href=\"#top\"><IMG alt=\"Go to top\" border=0 src=\"" + ImageDir + "/gotop.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	  <A href=\"javascript:printPreviewWindow()\"><IMG alt=\"Print preview window\" border=0 src=\"" + ImageDir + "/printer.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	  <A href=\"" + HomeURL + "\" target=_top><IMG alt=\"Go home\" border=0 src=\"" + ImageDir + "/gohome.gif\" width=20></A>") ;
    document.writeln ("      &nbsp; <A href=\"mailto:" + EMail + "\"><IMG alt=Mailto:" + EMail + " border=0 src=\"" + ImageDir + "/mail.gif\" width=20></A> &nbsp;") ;
    document.writeln ("	</TD>") ;
  }
  document.writeln ("  </TR>") ;
  document.writeln ("</TBODY></TABLE>") ;
}



