/* Variablendefinition */
var preloadFlag = false;
var Northeim    = newImage("../images/hello_nom.jpg");
var Einbeck     = newImage("../images/hello_ein.jpg");
var ToggleTimer;

/* Funktionen */
function newImage(arg) {
  if (document.images) {
    image = new Image();
    image.src = arg;
    return image;
        }
}
/* Grafiken laden, bevor die Seite aufgebaut wird. */
function preloadImages() {
  if (document.images) {
    oben     = newImage("../images/top.gif");
    topleft  = newImage("../images/topleft.gif");
    left     = newImage("../images/left.gif");
    righttop = newImage("../images/righttop.gif");
    rightbut = newImage("../images/rightend.gif");
    home     = newImage("../images/bhome.gif");
    fahrzeuge= newImage("../images/bfahr.gif");
    klassen  = newImage("../images/bklassen.gif");
    kontakt  = newImage("../images/bkontakt.gif");
    preise   = newImage("../images/bpreise.gif");
    unterri  = newImage("../images/bunterri.gif");
    preloadFlag = true;
  }
}

function start() {
   preloadImages();
}

/* Vergrösserter Bildausschnitt der Anfahrtsskizze */
function zoom_in(town) {
    var win_zoom;
    if (town == 1) {
      win_zoom = window.open("","win_zoom","width=704,height=390");
      win_zoom.document.write("<html><head><title>Zoom auf die Fahrschule<\/title><\/head><body style='background-image:url(../images/nom_zoom.jpg);background-repeat:no-repeat;'><div align='center' style='color:black;font-size:8pt;font-family:Arial,sans-serif;'>Quelle: Gelbe Seiten&reg; regional für Northeim, Einbeck und Umgebung 2001/2002<br /></div><\/body><\/html>");
    } else {
      win_zoom = window.open("","win_zoom","width=460,height=260");
      win_zoom.document.write("<html><head><title>Zoom auf die Fahrschule<\/title><\/head><body style='background-image:url(../images/ein_zoom.jpg);background-repeat:no-repeat;'><div align='center' style='color:black;font-size:8pt;font-family:Arial,sans-serif;'>Quelle: Gelbe Seiten&reg; regional für Northeim, Einbeck und Umgebung 2002/2003<br /></div><\/body><\/html>");
    }
    win_zoom.document.close();
}

/* Statuszeilen Anzeige dynamisch ändern */
function set_text_2_status(index) {
    var statustext;
    statustext = new Array();
    statustext[0] = "Herzlich willkommen auf den Internet Seiten der Fahrschule Spitzmacher";
    statustext[1] = "Hier ist für Sie immer ein Platz frei!";
    statustext[2] = "Wann starten wir zur ersten Fahrstunde?";
    statustext[3] = "Startseite der FS Spitzmacher";
    statustext[4] = "Theoretische und praktische Ausbildung";
    statustext[5] = "Der Klassenkompass";
    statustext[6] = "Meine kleinen Helfer";
    statustext[7] = "Qualität muss nicht teuer sein";
    statustext[8] = "Anfahrtsskizze und Kontaktinfos";
    statustext[9] = "Prüfung mit Demoprogramm";
    window.status = statustext[index];
}

/* PopUp Window öffnen */
function news() {
    var win_news;
    win_news = window.open("news.html","Spitzmacher News","width=220,height=75");
    win_news.name = "Spitzmacher News";
}

/* Wechsel zwischen Northeim und Einbeck auf der Startseite */
function toggle_picture() {
   if(document.Ort.src == Northeim.src){
      show_einbeck();
   }
   else {
     show_northeim();
   }
   ToggleTimer = window.setTimeout("toggle_picture();",2000);
}




function show_northeim() {
   document.Ort.src = Northeim.src;
   document.all.NOMString.style.color = "red";
   document.all.EINString.style.color = "blue";
   }

function show_einbeck() {
   document.Ort.src = Einbeck.src;
   document.all.EINString.style.color = "red";
   document.all.NOMString.style.color = "blue";
}

function OnMouseOverCity(CityID) {
   window.clearTimeout(ToggleTimer);
   if (CityID == 1) {show_northeim();}
   else             {show_einbeck();}
}

function GetHeight()
{
 if (window.innerHeight)
 {
   return (Math.round(Math.random()*(window.innerHeight-376))+document.body.scrollTop); //Netscape
 }
 else
 {
    if (document.body && document.body.offsetHeight)
    {
       return (Math.round(Math.random()*(document.body.offsetHeight-376))+document.body.scrollTop); //Explorer
    }
    else return 0;
 }
}

function GetWidth()
{
 if (window.innerWidth)    //Netscape
 {
    return (Math.round(Math.random()*(window.innerWidth-410))+document.body.scrollLeft);
 }
 else
 {
    if (document.body && document.body.offsetWidth)//Explorer
    {
       return (Math.round(Math.random()*(document.body.offsetWidth-410))+document.body.scrollLeft);
    }
    else return 0 ;
 }
}

function move_pic() {
  var rdx=GetHeight();
  var rdy=GetWidth();

  if (document.body && document.body.offsetWidth)
  {
     document.all["Smiley"].style.pixelTop=rdx;
     document.all["Smiley"].style.pixelLeft=rdy;
  } else {
     document.layers["Smiley"].left=rdy;
     document.layers["Smiley"].top=rdy;
  }
  aktiv = window.setTimeout("move_pic();",500);
}