// Java-Script-Unterprogramme für eine Navigationsleiste mit animierten Images.
// Folgende Variablen müssen in der Aufrufenden Seite definiert sein:
//   selectedItem = 4;           ImgName des die aktuelle Seite betregffenden Eintrags
//   image_source = 'image/';    Common-Verzeichnis
//   root                        Basisdirectory (index.htm)
// letzte Änderung: 23.05.01 We


<!--
var ver = "n2";
var ie = 0;
var ns = 1;
bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
     if (bName == "Netscape")
     {
        ie = 0; ns = 1;
        if (bVer >= 4) ver = "n3";
        else if (bVer == 2) ver = "n2";

     }
     if (bName == "Microsoft Internet Explorer")
     {
        ie = 1; ns = 0;
        if (bVer <4) ver = "e3";
        else if (bVer >= 4) ver = "n3";
     }

//alert ("Name = " + bName + "; Version = " + bVer + "; ver = " + ver);

var last_overID = 0;
var total_menu_items = 0;
var current_overID = 0;
var nostatus = '';
var menu_item;
subLoaded = 1;

function DoImage_(img,x1,y1,x2,y2,sub_text,alt_text)
{
   document.writeln('<P ALIGN="center">');
   if (ie > 0)
      document.writeln('<A HREF="javascript:showImg('+"'"+'image/'+img+"'"+','+x1+','+y1+','+"'"+sub_text+"'"+','+"'"+alt_text+"'"+')"> ');
   else
      document.writeln('<A HREF="' + image_source + 'galerie.htm?' +img+'|'+x1+'|'+y1+'|'+removeBlanks(sub_text)+'|'+removeBlanks(alt_text)+'|'+'" target="Bildergalerie"> ');
   document.writeln('<img src="thumb/'+img+'.jpg" width="'+x2+'" height="'+y2+'" border="0" alt="'+alt_text+'"></A><BR>');
   document.writeln('<FONT SIZE="2" FACE="Comic Sans MS">'+alt_text+'</FONT></P>');
}

function removeBlanks(t)
{
   var a;
   var r;
   var l;
   var i;
   a = t.split(" ");
   l= a.length;
   r=a[0];
   for(i = 1; i < l; i++)
    {
      r = r +"~"+ a[i];
    }
   //alert("Input=" +t + " Len="+l +" Output=" +r);
   return r;
}


function MenuHilite (itemID) {
   current_overID = itemID;
   if (current_overID != last_overID) {
       if (menu_item [current_overID].imgname != selectedItem) {
          document.images [current_overID - 1].src = menu_item [itemID].menu_img_on.src;
       }
       if (last_overID != 0 && menu_item [last_overID].imgname != selectedItem) {
          document.images [last_overID - 1].src = menu_item [last_overID].menu_img_off.src;
       }
       last_overID = current_overID;
   }
}


function MenuDeHilite () {
     if (menu_item [current_overID].imgname != selectedItem)
     {
       document.images [current_overID - 1].src = menu_item [current_overID].menu_img_off.src;
     }
     last_overID = 0;
     current_overID = 0;
}


function menu_item (imgname,statval,link1,link2) {
     this.imgname = imgname;
     this.statval = statval;
     this.link1 = getIP(link1);
     this.link2 = getIP(link2);
     this.img_prefix = image_source + imgname;
     if (ver == 'n3') {
          this.menu_img_off = new Image ();
          this.menu_img_off.src = this.img_prefix + "_off.gif";
          this.menu_img_on = new Image ();
          this.menu_img_on.src = this.img_prefix + "_on.gif";
          this.menu_img_inarea = new Image ();
          this.menu_img_inarea.src = this.img_prefix + "_in.gif";
     }
}

function menu_item_ie (imgname,link1,link2,statval) {
     this.imgname = imgname;
     this.statval = statval;
     this.link1 = getIP(link1);
     this.link2 = getIP(link2);
     this.img_prefix = image_source + imgname;
}

function new_menu_item_ (imgname,statval,link1,link2) {
        total_menu_items++;
        if (ver != 'e3') {
           menu_item [total_menu_items] = new menu_item (imgname,statval,link1,link2);
        }
        else{
           menu_item [total_menu_items] = new menu_item_ie (imgname,link1,link2,statval);
        }
}

function initMenu(baseDir,subMenu1,subMenu2,subMenu3)
{
     //new_menu_item ('home','Homepage', baseDir +'index.htm','');
     new_menu_item ('home','Homepage', 'puretec$index.htm','');
     new_menu_item ('news','Neuigkeiten', 'nikoma$news01/news01.htm','');

     new_menu_item ('modell','Modellbau', 'nikoma$model01/model01.htm','');
     if (subMenu1 =='modell')
     {
        new_menu_item ('big','Think Big', 'nikoma$model01/big/big.htm','');
        if (subMenu2 =='big')
        {
           new_menu_item ('klemm','Klemm L25d', 'nikoma$model01/big/klemm25/klemm1.htm','');
           new_menu_item ('bleriot','Bleriot', 'tiscali$model01/big/bleriot/bleriot1.htm','');
           new_menu_item ('cap232','Cap 232', 'nikoma$model01/big/cap232/cap1.htm','');
        }
        new_menu_item ('slowie','Slow Flyer', 'nikoma$model01/slow/slow.htm','');
        if (subMenu2 =='slowie')
        {
           new_menu_item ('vib1','Slowflyer-Meeting in Vilsbiburg, Oktober 1999', 'nikoma$model01/slow/vib01/vib01.htm','');
           new_menu_item ('dorfen1','Heilig Drei König Hallenflugmeeting des FMG Dorfen, Januar 2000', 'nikoma$model01/slow/dorfen01/dorfen01.htm','');
           new_menu_item ('mfgg1','Slowflyertreffen des MFG Geisenhausen, März 2000', 'nikoma$model01/slow/mfgg01/mfgg01.htm','');
           new_menu_item ('mfgg2','Slowflyertreffen des MFG Geisenhausen, Januar 2001', 'tiscali$model01/slow/mfgg02/mfgg1.htm','');
           new_menu_item ('deltap','Delta-Project: Ein Delta als Slowflyer', 'nikoma$model01/slow/delta/delta01.htm','');
        }
        new_menu_item ('war','Warbirds', 'nikoma$model01/warbird/warbird.htm','');
        if (subMenu2 =='war')
        {
           new_menu_item ('me309','Me 309', 'nikoma$model01/warbird/me309/me309.htm','');
           new_menu_item ('ju87','Ju 87 Stuka', 'nikoma$model01/warbird/ju87/ju87_01.htm','');
           new_menu_item ('se5','S.E.5', 'tiscali$model01/warbird/se5/se51.htm','');
        }
     }
     new_menu_item ('impress','Impressum', 'nikoma$impr/impr01.htm','');
     if (subMenu1 == 'impressum')
     {
        new_menu_item ('fam','Familie', 'nikoma$impr/fam01/fam01.htm','');
        new_menu_item ('wind','Windsurfen', 'nikoma$impr/surf01/surf01.htm','');
     }

     new_menu_item ('gast','Gästebuch', 'http://two.guestbook.de/gb.cgi?gid=382018&prot=ahbugh','');
     new_menu_item ('links','Links', 'nikoma$link01/link01.htm','');
}

function draw_menu_line_(itemno)
{
   with (menu_item [itemno])
   {
      "' + menu_item [itemno].link1 + '.htm"
      if (ver != 'n3')
      {
          if (menu_item [itemno].imgname != selectedItem)
          {
             document.writeln ('<A HREF="' + menu_item [itemno].link1 + '" ONMOUSEOVER="self.status = ' + "'" + statval + "'" + ';return true" ONMOUSEOUT="self.status = ' + "'" + '' + "'" + ';return true"><IMG SRC="' + menu_item [itemno].img_prefix + '_off.gif" BORDER="0" WIDTH="130" HEIGHT="30" ALT="' + statval + '"></A><BR>');
          }
          else
          {
             document.writeln ('<A HREF="' + menu_item [itemno].link1 + '" ONMOUSEOVER="self.status = ' + "'" + statval + "'" + ';return true" ONMOUSEOUT="self.status = ' + "'" + '' + "'" + ';return true"><IMG SRC="' + menu_item [itemno].img_prefix + '_in.gif" BORDER="0" WIDTH="130" HEIGHT="30" ALT="' + statval + '"></A><BR>');
          }
      }
      else
      {
          if (menu_item [itemno].imgname != selectedItem)
          {
             document.writeln ('<A HREF="' + menu_item [itemno].link1 + '" ONMOUSEOVER="MenuHilite (' + itemno + ');self.status = ' + "'" + statval + "'" + ';return true" ONMOUSEOUT="MenuDeHilite ();self.status = ' + "'" + '' + "'" + ';return true"><IMG SRC="' + menu_item [itemno].menu_img_off.src + '" BORDER="0" WIDTH="130" HEIGHT="30" ALT="' + statval + '"></A><BR>');
          }
          else
          {
             document.writeln ('<A HREF="' + menu_item [itemno].link1 + '" ONMOUSEOVER="MenuHilite (' + itemno + ');self.status = ' + "'" + statval + "'" + ';return true" ONMOUSEOUT="MenuDeHilite ();self.status = ' + "'" + '' + "'" + ';return true"><IMG SRC="' + menu_item [itemno].menu_img_inarea.src + '" BORDER="0" WIDTH="130" HEIGHT="30" ALT="' + statval + '"></A><BR>');
          }
      }
   }
}

function draw_menu_()
{
   for (var cnt = 1; cnt <= total_menu_items; cnt++)
   {
       draw_menu_line_(cnt);
   }
}

function DrawFwBackButtons_(refBack,altBack,refFw,altFw)
{
   document.writeln('<TABLE BORDER="0" WIDTH="100%">');
   document.writeln('<TR><TD>&nbsp;</TD><TD><TABLE WIDTH="200" ALIGN="center"><TR>');
   document.writeln('<TD><A HREF='+'"'+getIP(refBack)+'"'+'><IMG SRC="'+image_source+'back.gif" ALT='+'"'+altBack+'"'+' WIDTH="40" HEIGHT="43" BORDER="0"></A></TD>');
   document.writeln('<TD><A HREF='+'"http://www.hwegener.de/index.htm"'+'><IMG SRC="'+image_source+'home.gif" ALT="zur Homepage" WIDTH="42" HEIGHT="43" BORDER="0"></A></TD>');
   document.writeln('<TD><A HREF='+'"'+getIP(refFw)+'"'+'><IMG SRC="'+image_source+'forward.gif" ALT='+'"'+altFw+'"'+' WIDTH="42" HEIGHT="43" BORDER="0"></A></TD>');
   document.writeln('</TR></TABLE></TD> <TD>&nbsp;</TD></TR>');
   document.writeln('</TABLE>');
}

var ImageWin = window;
var yOfs;
var xOfs;
var aktZoom = 1;  // muß variabel sein, identisch mit minZoom_
var maxZoom;


function show_image_(img,x,y,sub_text,alt_text)
{
   var len_ = img.length;
   var img_ = img.substring(0 , len_-4);
   showImg_(img_,x,y,sub_text,alt_text)
}


function showImg_(img,x,y,sub_text,alt_text)
{
   var len;
   maxZoom = 0;

// Opera kennt im neuen Fenster den alten Pfad nicht, also absoluten Pfad basteln:
img = window.location.href.substr(0, window.location.href.lastIndexOf("/") + 1 ) + img;

   if (ver == "e3")
   {
        self.location.href = img+'.jpg';
   }
   else
   {
        yOfs = window.pageYOffset;
        xOfs = window.pageXOffset;

        if (ImageWin.closed == true)
        {
           ImageWin = window.open("","Bildergalerie","width=700,height=500,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,status=yes");
//           alert ("Fenster neu geöffnet");
        }

        if (ImageWin.name != "Bildergalerie")
        {
           ImageWin = window.open("","Bildergalerie","width=700,height=500,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,status=yes");
//           alert ("Fenster neu angelegt");
        }

        len = img.length;
        if ( img.substring(len-2, len) == "_m")
            maxZoom = 1;
        if ( img.substring(len-2, len) == "_l")
            maxZoom = 2;

        ImageWin.document.open();

        ImageWin.document.writeln("<HTML>");
        ImageWin.document.writeln("<HEAD>");
        ImageWin.document.writeln("<TITLE>Bildergalerie</TITLE>");

        if (maxZoom > 0)
        {
// Javascript-Unterprogrammdatei laden, dies geht aber nur beim Explorer
//           ImageWin.document.write('<script language=' + '"' + 'JavaScript' + '"');
//           ImageWin.document.write(' SRC=' + '"' + ' ../../../common/navsub.js' + '"');
//           ImageWin.document.writeln('TYPE=' + '"' + 'text/javascript' + '"' +'>');
//           ImageWin.document.writeln('</Script>');
// Unterprogramm ins Tochterfenster schreiben
// bei Netscape kann im Tochterfenster keine Javascript-Datei geladen werden!
             ImageWin.document.writeln('<script language=' + '"' + 'JavaScript' + '"' +'>');
             if (maxZoom == 1)
               ImageWin.document.writeln(' var aktZoom_ = 1; ');
             else
               ImageWin.document.writeln(' var aktZoom_ = 0; ');
             ImageWin.document.writeln('function changeImg(img)');
             ImageWin.document.writeln('{');
             ImageWin.document.writeln(' var minZoom_ = 0; ');
             ImageWin.document.writeln(' var len_ = img.length; ');
             ImageWin.document.writeln(' var img_ = img.substring(0 , len_-2);  ');
             ImageWin.document.writeln(' if(img.substring(len_-2, len_) == ' + '"' +"_m" + '"' + ')   minZoom_ = 1; ');
             ImageWin.document.writeln(' if(img.substring(len_-2, len_) == ' + '"' +"_l" + '"' + ')   minZoom_ = 0; ');
             ImageWin.document.writeln(' ++aktZoom_;  ');
             ImageWin.document.writeln(' if(aktZoom_ > 2)   aktZoom_ = minZoom_; ');
             ImageWin.document.writeln(' if(aktZoom_ == 0)  document.picName.src = img_ +' + '"' + "_l.jpg" + '"' + '; ');
             ImageWin.document.writeln(' if(aktZoom_ == 1)  document.picName.src = img_ +' + '"' + "_m.jpg" + '"' + '; ');
             ImageWin.document.writeln(' if(aktZoom_ == 2)  document.picName.src = img_ +' + '"' + "_h.jpg" + '"' + '; ');
             ImageWin.document.writeln('}');
             ImageWin.document.writeln('</script>');
// Den alt_text manipulieren
             alt_text = "Click to zoom: " + alt_text;
        }

        ImageWin.document.writeln("</HEAD>");
        ImageWin.document.writeln("<BODY BACKGROUND="+'"'+ image_source + "aktuhint.gif"+'"'+" BGCOLOR="+'"'+"FFFFFF"+'"'+">");

        ImageWin.document.writeln("<P ALIGN="+'"'+"center"+'"'+"><FONT SIZE="+'"'+"5"+'"'+" FACE="+'"'+"Comic Sans MS"+'"'+">Bildergalerie<BR></FONT>");
        ImageWin.document.write("<P ALIGN="+'"'+"center"+'"'+">");

        if (maxZoom > 0)
            ImageWin.document.write("<A HREF="+'"'+"javascript:changeImg("+"'"+ img +"'"+ ")" + '"'+ ">");

        ImageWin.document.write("<img src="+'"'+ img + '.jpg"' + " width="+'"'+x+'"'+" height="+'"'+y+'"');
        ImageWin.document.write(" border="+'"'+0+'"'+" alt="+'"'+alt_text+'"'+ " name="+'"'+"picName"+'"'+  ">");

        if (maxZoom > 0)
            ImageWin.document.write ("</A>");

        ImageWin.document.write("</P>");
        ImageWin.document.writeln("<P ALIGN="+'"'+"center"+'"'+"><FONT SIZE="+'"'+"3"+'"'+" FACE="+'"'+"Comic Sans MS"+'"'+">" + sub_text +"</FONT></P>");
        if (maxZoom > 0)
            ImageWin.document.writeln("<P ALIGN="+'"'+"center"+'"'+"><FONT SIZE="+'"'+"2"+'"'+" FACE="+'"'+"Comic Sans MS"+'"'+">" + "Ins Bild klicken um zu zoomen!" +"</FONT></P>");

        ImageWin.document.writeln("</BODY>");
        ImageWin.document.writeln("</HTML>");
        ImageWin.document.close();
        ImageWin.focus();
        if (ver == "n3")
        {
           window.setTimeout("window.scrollTo(xOfs,yOfs)",10);
        }
     }
}

function getIP(t)
{
   var a;
   var b;
   var l;
   var i;
   var r;

   i = t.indexOf("$");
   if (i < 0) return t;

   l = t.length;
   a = t.substring(0,i);
   b = t.substring(i+1,l);

   if(a=="nikoma")
     return ("http://home.nikocity.de/harald_wegener/" + b);
     //return ("http://212.122.128.73/harald_wegener/" + b);
     //return ("file:////G:/MyWeb/nikoma/" + b);
   if(a=="tiscali")
     return ("http://home.tiscalinet.de/hwegener/" + b);
     //return ("http://212.122.129.124/hwegener/" + b);
     //return ("file:////G:/MyWeb/tiscali/" + b);
   if(a=="puretec")
     return ("http://www.hwegener.de/" + b);
     //return ("file:////G:/MyWeb/puretec/" + b);

   return t;
}

// -->