function preload() 
{
	var d=document; 
	if(d.images)
		{
		if(!d.pic) d.pic=new Array();
		var i, j=d.pic.length, a=preload.arguments; 
		for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.pic[j]=new Image; d.pic[j++].src=a[i];}
		}
	init()
}

function init()
{
	p=document.getElementById('km').style.top
	topOrt[0]=p.substr(0,p.length-2)
	p=document.getElementById('km').style.left
	leftOrt[0]=p.substr(0,p.length-2)
	
	p=document.getElementById('text').style.top
	topOrt[1]=p.substr(0,p.length-2)
	p=document.getElementById('text').style.left
	leftOrt[1]=p.substr(0,p.length-2)
	
	p=document.getElementById('ekf').style.top
	topOrt[2]=p.substr(0,p.length-2)
	p=document.getElementById('ekf').style.left
	leftOrt[2]=p.substr(0,p.length-2)
	
	p=document.getElementById('km_s').style.top
	topOrt_S[0]=p.substr(0,p.length-2)
	p=document.getElementById('km_s').style.left
	leftOrt_S[0]=p.substr(0,p.length-2)
	
	p=document.getElementById('text_s').style.top
	topOrt_S[1]=p.substr(0,p.length-2)
	p=document.getElementById('text_s').style.left
	leftOrt_S[1]=p.substr(0,p.length-2)
	
	p=document.getElementById('ekf_s').style.top
	topOrt_S[2]=p.substr(0,p.length-2)
	p=document.getElementById('ekf_s').style.left
	leftOrt_S[2]=p.substr(0,p.length-2)
	
	interval1=setTimeout("ablauf()",10000)
	interval2=setTimeout("klapp('auf')",2000)	
}

var i1=0
var interval1
var schritt=0

function ablauf()
{
schritt++	
	
	switch(schritt)
	{
	case 1:
	interval1=setTimeout("ablauf()",400)
	interval[0]=setTimeout("hopp(0)",40)	
	break
	case 2:
	interval1=setTimeout("ablauf()",300)
	interval[1]=setTimeout("hopp(1)",40)	
	break
	case 3:
	interval1=setTimeout("ablauf()",1000)
	interval[2]=setTimeout("hopp(2)",40)
	break
	default:	
	interval1=setTimeout("ablauf()",1000)
	schritt=schritt%4
	}	
}

var Lauf=new Array(0,0,0)
var Teil=new Array('hopp(0)','hopp(1)','hopp(2)')
var Objekt=new Array('km','text','ekf')
var Objekt_S=new Array('km_s','text_s','ekf_s')
var topOrt=new Array(3)
var topOrt_S=new Array(3)
var leftOrt=new Array(3)
var leftOrt_S=new Array(3)
var interval=new Array(3)
var Richtung=new Array(1,1,1)
var xweg=new Array(135,-120,0)
var yweg=new Array(40,40,-50)
var zweg=new Array(40,30,10)
var next=new Array(95,70,40)
PI=3.1415926535

function hopp(Bild)
{
step=16
	
	xmove=xweg[Bild]*Richtung[Bild]
	ymove=yweg[Bild]*Richtung[Bild]
	
	if (Lauf[Bild]<=step)
	{	
	x=xmove-xmove*Math.cos(Lauf[Bild]/step*PI)
	y=ymove-ymove*Math.cos(Lauf[Bild]/step*PI)
	z=zweg[Bild]-zweg[Bild]*Math.cos(Lauf[Bild]/step*2*PI)
	document.getElementById(Objekt_S[Bild]).style.top=topOrt_S[Bild]-0+z+y
	document.getElementById(Objekt_S[Bild]).style.left=leftOrt_S[Bild]-0+z+x
	document.getElementById(Objekt[Bild]).style.top=topOrt[Bild]-z/4+y
	document.getElementById(Objekt[Bild]).style.left=leftOrt[Bild]-z/4+x
	
	interval[Bild]=setTimeout(Teil[Bild],next[Bild])	
	Lauf[Bild]++	
	}
	else
	{
	Lauf[Bild]=0
	topOrt_S[Bild]=topOrt_S[Bild]-0+ymove*2
	leftOrt_S[Bild]=leftOrt_S[Bild]-0+xmove*2
	topOrt[Bild]=topOrt[Bild]-0+ymove*2
	leftOrt[Bild]=leftOrt[Bild]-0+xmove*2
	Richtung[Bild]=-Richtung[Bild]
	}	
}

var i2=0
var interval2

function klapp(Vorgang)
{
step=200
speed=20 // Öffnungsgeschwindigkeit der Klappe
if (Vorgang=='auf')
	{	amp2=210	}
	else 
	{
	document.getElementById('Rahmen').style.width=0
	document.getElementById('Rahmen').style.height=0
	amp2=-210
	}
	
if (i2<step)	
	{
	i2++
	amp1=50
	//amp2=-210
	x=Math.round(amp1*Math.sin(i2/step*PI))
	y=Math.round(amp2*Math.cos(i2/step*PI))
	z=Math.round(15*Math.sin(i2/step*PI))
	if (y<=0)
	{b=-y; a=0}
	else
	{b=0;a=y}
	document.getElementById('ext_lo').style.width=x
	document.getElementById('ext_lu').style.width=x
	document.getElementById('ext_ro').style.width=x
	document.getElementById('ext_ru').style.width=x
	
	document.getElementById('ext_lo').style.height=b
	document.getElementById('ext_lu').style.height=a
	document.getElementById('ext_ro').style.height=b
	document.getElementById('ext_ru').style.height=a
	document.getElementById('kante').style.height=z
	document.getElementById('table2').style.top=-a-z
	document.getElementById('ext_u').style.height=a
	
	v=Vorgang
	interval2=setTimeout("klapp(v)",speed)
	}
	else
	{
	i2=0
	clearTimeout(interval2)
	if (Vorgang=='auf')
	{
	document.getElementById("Rahmen").src="Text.html"
	zoom()
	}			
	}
}

i5=0
var interval5

function zoom()
{
speed=50
time=2000
steps=Math.round(time/speed)
if (i5<steps)
	{
	i5++
	amp=i5*i5/steps/steps
	hor=Math.round(amp*510)
	vert=Math.round(amp*190)
	
	document.getElementById('Rahmen').style.width=hor	
	document.getElementById('Rahmen').style.height=vert
	interval5=setTimeout("zoom()",speed)
	}
	else
	{
	clearTimeout(interval5)
	//document.getElementById("Rahmen").src="Text.html"
	i5=Zeit()
	Textfeld.scroll()
	}
}
i6=0
var interval6

function Zeit()
{
step=200
speed=2000
	
if (i6<2)	
	{
	i6++ 		
	interval5=setTimeout("Zeit()",speed)
	}
	else
	{
	i6=0
	clearTimeout(interval6)
	return i6
	}
}

function stop()
{
clearTimeout(interval1)
clearTimeout(interval[0])
clearTimeout(interval[1])
clearTimeout(interval[2])
clearTimeout(interval2)
}

