// JavaScript Document

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}


function F1open(datei){
	F1=window.open(datei+".htm", "tec", "width=240,height=140,screenX=400,screenY=500,top=500,left=400,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F1.focus();
}
function F2open(datei){
	F2=window.open(datei+".htm", "imp", "width=240,height=140,screenX=300,screenY=300,top=300,left=300,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F2.focus();
}
function F3open(datei){
	F3=window.open(datei+".htm", "hom", "width=240,height=140,screenX=100,screenY=250,top=100,left=250,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F3.focus();
}
function F4open(datei){
	F4=window.open(datei+".htm", "pro", "width=240,height=140,screenX=400,screenY=200,top=400,right=200,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F4.focus();
}
function F5open(datei){
	F5=window.open(datei+".htm", "peg", "width=240,height=140,screenX=400,screenY=600,top=400,left=200,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F5.focus();
}
function F6open(datei){
	F6=window.open(datei+".htm", "cli", "width=240,height=140,screenX=600,screenY=600,top=600,left=600,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F6.focus();
}
function F7open(datei){
	F7=window.open(datei+".htm", "gol", "width=240,height=140,screenX=150,screenY=100,top=150,left=100,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F7.focus();
}
function F8open(datei){
	F8=window.open(datei+".htm", "fru", "width=240,height=140,screenX=200,screenY=550,top=200,left=550,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F8.focus();
}
function F9open(datei){
	F9=window.open(datei+".htm", "vox", "width=240,height=140,screenX=200,screenY=550,top=200,left=550,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F9.focus();
}
function F10open(datei){
	F10=window.open(datei+".htm", "sit", "width=240,height=140,screenX=200,screenY=550,top=200,left=550,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F10.focus();
}


var a=-50, b=-50;  //Initialisierung der Layervariablen fuer bus1 auf  left/top BEZIEHT SICH AUF DEN START
var c=-50, d=-50;  //Initialisierung der Layervariablen fuer bus2
var e, f=150; //Initialisierung der Layervariablen fuer bus3
var g=-50, h; //Initialisierung der Layervariablen fuer bus4
var i=150,j;	//bus 5
var k, l=850;	//bus6
var m=100, n=-1650;  //Initialisierung der Bus7
var o, p=600;		//bus 8 
var q=1, r=200;		//bus 9 
var breite, hoehe;
var timer;




function abfrage ()
{
  if (navigator.appName=='Netscape' && navigator.appVersion.charAt(0)>='4')
     {
       breite=screen.width;
       hoehe=window.innerHeight;
       c=breite+20;
       d=hoehe+5;
	c3=breite+100;
	o=c3;
	e=c;
       h=d;
       window.setTimeout ('bewegen_nc()', 20);
     }
  if (navigator.appName=='Mozilla')
     {
       breite=screen.width;
       hoehe=window.innerHeight;
       c=breite+20;
       d=hoehe+20;

	c3=breite+100;
	o=c3;
     e=c;
       h=d;
       window.setTimeout ('bewegen_nc()', 20);
     }
 
 if (navigator.appName=='Microsoft Internet Explorer' && navigator.appVersion.charAt(0)>='4')
     {
       breite=screen.width;
       hoehe=screen.height;
       c=breite+20;
       d=hoehe+20;
		c3=breite+100;
		o=c3;
       e=c;
       h=d;
       window.setTimeout ('bewegen_ie()', 20);
     }
}

function bewegen_nc()

{

  a+=3;       //Variablen hochzaehlen. Syntax entspricht a=a+2. Je hoeher die Zahl, desto staerker wird bei jedem Durchlauf die Koordinate geaendert, desto hoeher ist die Geschwindigkeit
  b+=6;		//bei bus1 werden die Koords beide hochgezaehlt, d.h. er faengt beide mit minus an und arbeitet sich nach rechts unten
  c-=5;		// bus2 genau umgekehrt, wird runtergezaehlt, laeuft also von rechts unten nach links oben
  d-=8;
  e-=5;		// bei bus3 wird die  x-Koordinate runtergezaehlt: er faehrt nach  links
  f+=0.001;		// die y Koordinate wird hochgezaehlt:  erfaehrt nach unten
  g+=2;		// bus4: x wird hochgezaehlt: er faehrt nach rechts. 
  h-=2;		// y wird runtergezaehlt: er faehrt nach oben
  i+=1;		// bus5 wird nur auf x hoch gezaehlt: er faehrt nur nach rechts 
  j=1;
  k=0;		// bus6 wird nur auf y runtergezaehlt: er faehrt nur nach oben
  l-=10;
  m+=0.1;		// bus7 wird nur auf y hochgezaehlt; er faehrt hoffentlich nur nach unten
   n+=4;
	o-=12;		//bus 8 faehrt nur nach links
	p+=0.001;
	q+=9;		//		bus 9 nur nach links
	r-=1;
  if (b<(hoehe+20))
    {
       document.getElementById("bus1").style.left=a;
       document.getElementById("bus1").style.top=b;
 
    }

  if (c>100)
    {
       document.getElementById("bus2").style.left=c;
       document.getElementById("bus2").style.top=d;
    }


  if (e>900)
    {
       document.getElementById("bus3").style.left=e;
       document.getElementById("bus3").style.top=f;
    }
	else
{	
		
		timer= setTimeout ('weiterfahren_nc()', 900); // hier wird das timeout fuer die waitingtime festgelegt
}

 if (g<400)
    {
       document.getElementById("bus4").style.left=g;
       document.getElementById("bus4").style.top=h;
    }
if (g==400)
{    intervalId = setInterval("nextFrame()", interval);
       document.getElementById("bus9").style.visibility="hidden";
}

 if (i<(breite-70))
    {
       document.getElementById("bus5").style.left=i;
       document.getElementById("bus5").style.top=j;
        window.setTimeout ('bewegen_nc()', 50);    // die Function bewegen ruft  sich solange selber auf, wie  in setTimeout festgelegt. Hier alle 50 Millisekunden
	
    }
 if (l>-30)
    {
       document.getElementById("bus6").style.left=k;
       document.getElementById("bus6").style.top=l;
        <!-- window.setTimeout ('bewegen_nc()', 2000);  -->   // die Function bewegen ruft  sich solange selber auf, wie  in setTimeout festgelegt. Hier alle 20 Millisekunden
    }

  if (n<(hoehe+40))
    {
       document.getElementById("bus7").style.left=m;
       document.getElementById("bus7").style.top=n;
    }
	if (o>10)
	{
       document.getElementById("bus8").style.left=o;
       document.getElementById("bus8").style.top=p;
	}
	if (q<850)
	{
       document.getElementById("bus9").style.left=q;
       document.getElementById("bus9").style.top=r;
	}
}

function weiterfahren_nc(timer)
{		 <!-- clearTimeout (timer); -->
		if (e>-300)
{
		  e-=5;
		f-=2;
		document.getElementById("bus3").style.left=e;
       document.getElementById("bus3").style.top=f;
		window.setTimeout ('weiterfahren_nc()', 150);
	}	
}

function bewegen_ie()

{

  a+=3;       //Variablen hochzaehlen. Syntax entspricht a=a+2. Je hoeher die Zahl, desto staerker wird bei jedem Durchlauf die Koordinate geaendert, desto hoeher ist die Geschwindigkeit
  b+=6;		//bei bus1 werden die Koords beide hochgezaehlt, d.h. er faengt beide mit minus an und arbeitet sich nach rechts unten
  c-=5;		// bus2 genau umgekehrt, wird runtergezaehlt, laeuft also von rechts unten nach links oben
  d-=8;
  e-=5;		// bei bus3 wird die  x-Koordinate runtergezaehlt: er faehrt nach  links
  f+=2;		// die y Koordinate wird hochgezaehlt:  erfaehrt nach unten
  g+=2;		// bus4: x wird hochgezaehlt: er faehrt nach rechts. 
  h-=2;		// y wird runtergezaehlt: er faehrt nach oben
  i+=1;		// bus5 wird nur auf x hoch gezaehlt: er faehrt nur nach rechts 
  j=1;
  k=0;		// bus6 wird nur auf y runtergezaehlt: er faehrt nur nach oben
  l-=10;
  m+=0.1;		// bus7 wird nur auf y hochgezaehlt; er faehrt hoffentlich nur nach unten
   n+=12;
	o-=8;		//bus 8 faehrt nur nach links
	p+=0.001;
	q+=9;		//		bus 9 nur nach rechts
	r-=1;
  if (b<(hoehe+20))
    {
       bus1.style.left=a;
       bus1.style.top=b;
 
    }

  if (c>100)
    {
       bus2.style.left=c;
       bus2.style.top=d;
    }


  if (e>900)
    {
       bus3.style.left=e;
       bus3.style.top=f;
    }
		else
		{			
		timer= setTimeout ('weiterfahren_ie()', 900); // hier wird das timeout fuer die waitingtime festgelegt
		} 
	if (g<400)
    {
       bus4.style.left=g;
       bus4.style.top=h;


    }
if (g==400)
{    intervalId = setInterval("nextFrame()", interval);
       bus9.style.visibility="hidden";
}

 if (i<(breite-70))
    {
       bus5.style.left=i;
       bus5.style.top=j;
       window.setTimeout ('bewegen_ie()', 50);
    }

 if (l>-30)
    {
       bus6.style.left=k;
       bus6.style.top=l;
    }

  if (n<(hoehe+2))
    {
       bus7.style.left=m;
       bus7.style.top=n;
    }
	if (o>10)
	{
       bus8.style.left=o;
       bus8.style.top=p;
	}
	if (q<850)
	{
       bus9.style.left=q;
       bus9.style.top=r;

	}

}



function weiterfahren_ie(timer)
{		 <!-- clearTimeout (timer); -->
		if (e>-300)
{
		  e-=5;
		f-=2;
		bus3.style.left=e;
       bus3.style.top=f;
		window.setTimeout ('weiterfahren_ie()', 150);
	}	
}


function gameOver ()
{
	F1=window.open("game.htm", "game", "width=240,height=140,screenX=400,screenY=500,top=500,left=400,scrollbars=no,location=no,menubar=no,resizable=no,dependent=yes");
	F1.focus();

}







