// ************** VARIABLES ************************************************
var portrait = 0;
var nebel  = 1;

//Ruhe  = new Array();
//Aktiv = new Array();

//Klick               = new Image();
//Klick.src           = "http://www.astroservice.com/Bilder/Nova.jpg";

//Ruhe[portrait]     = new Image();
//Ruhe[portrait].src = "http://www.astroservice.com/Bilder/Thales.jpg";
//Aktiv[portrait]     = new Image();
//Aktiv[portrait].src = "http://www.astroservice.com/Bilder/Saturn.jpg";

//Ruhe[nebel]     = new Image();
//Ruhe[nebel].src = "http://www.astroservice.com/Bilder/DreiSaeulen.jpg";
//Aktiv[nebel]     = new Image();
//Aktiv[nebel].src = "http://www.astroservice.com/Bilder/Stupa.jpg";


// ************** GO FUNCTION *****************************************
function Go(x) {
  if(x == "none") {
    return;
  } else {
    //OpenSubwindow(x);
    location.href = x;
  }
}


// ************** ZEIGE FUNCTION *****************************************
function Zeige(bildname, bildtyp) {
  if (bildtyp == 0) {
    window.document.images[bildname].src = Ruhe[eval(bildname)].src;
  } else if (bildtyp == 1) {
    window.document.images[bildname].src = Aktiv[eval(bildname)].src;
  } else if (bildtyp == 2) {
    window.document.images[bildname].src = Klick.src;
  }
}


// ************** OpenWin FUNCTIONS *****************************************
var Subwindow = null

function OpenSubwindow(url) {
  if(!Subwindow || Subwindow.closed) {
    Subwindow=window.open(url, "places", "width=600,height=500,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
  } else {
    Subwindow.focus("places");
  }
}

function OpenInWindow(url) {
  window.location.href = url;
}


// ************** INIT FUNCTION *****************************************
function setTitles() {
  // Nur MS IE; Netscape schaffts einfach nicht!

  if(document.all) {

    // Beide Titel setzen
    document.all.divTitel.innerHTML = document.anchors[0].innerText

    //document-Titel nur, wenn nicht Hauptseite
    if (document.URL.length > 29) {
      document.title = document.title + ": " + document.anchors[0].innerText
    }
    //window.setTimeout('document.all.divTitel.innerHTML = document.anchors[0].innerText', 1000);
    //window.setTimeout('document.title = document.anchors[0].innerText', 1000);

    // Aktuellen Link herausnehmen
    // Dazu alle Links mit aktuellem HREF vergleichen:
    // Wenn letztes Zeichen "/" war, muss man vorletztes Wort nehmen, sonst letztes
    words = document.URL.split("/");
    if (words[words.length - 1].length == 0) {
      fileURL = words[words.length - 2];
    } else {
      fileURL = words[words.length - 1];
    }
    
    // durch alle Links im Dokument laufen:
    for(i=0; i < document.links.length; i++) {
      words = document.links[i].href.split("/");
      // wenn letztes Zeichen "/" war, muss man vorletztes Wort nehmen, sonst letztes
      if (words[words.length - 1].length == 0) {
        fileLink = words[words.length - 2];
      } else {
        fileLink = words[words.length - 1];
      }

 	// ist es der aktuelle Link, aber nicht einer von den unsichtbaren oder Bildern?
      // den ganzen Linkausdruck holen
      linkHTML = document.links[i].outerHTML;
      if(fileLink.match(eval("/" + fileURL + "/"))
        && !(linkHTML.match(eval("/winzig/")))
        && !(linkHTML.match(eval("/Zeige/"))))
      {
        // Linkverhalten löschen und aktuellen Links ROT MARKIEREN,
        // indem man andere "Umgebung" definiert:
        document.links[i].outerHTML = document.links[i].innerText.fontcolor("#000000");
        //document.links[i].outerHTML = "<font size=1>" + document.links[i].innerText.bold() + "</font>";
        // set i one back, because the links are one less!!!
        i--;
      }
    }

  } else if(document.layers){
    //document.divTitel.document.open();
    //document.divTitel.document.write("ddddddddddddddd");
    //document.divTitel.document.close();
  }

  // Netscape stürzt ab, wenn style in input! Probleme auch bei justify
  //if (navigator.appName != "Netscape") { 
    //document.mantra.stopp.style.backgroundColor = "#E0F0FF";
    //document.all.pHaupt.style.textAlign = "justify";
    //document.all.mainTable.position = "absolute";
    //document.all.mainTable.top = "10";
    //document.all.pHaupt.innerText="kjhjh";
  //}
}