altzeig = "zeig1";
altbild = "bild1";
altcounter=1;
Info=null;
alticon = "icon1";
xpos = 30;
a=30;
o=405;
pos_x_text=600;
var links=null;
var rechts=null;
var oben=null;
var laufschr=null;
var stopper=1;

function menu()
{
if (screen.availHeight>800)
{
f=screen.availHeight - 580;
f=f/4;
f=parseInt(f);
f=screen.availHeight - f*3;
document.getElementById("menu").style.top =f;
document.getElementById("menu").style.visibility = "visible";
}else{document.getElementById("menu").style.visibility = "visible";}
}

function breite()
{
var div_icons_breite=document.getElementById("icons").offsetWidth + 30;
c=div_icons_breite - screen.availWidth;
if (screen.availWidth < div_icons_breite)
	{
	document.getElementById("links").style.visibility = "visible";
	document.getElementById("rechts").style.left =screen.availWidth - 60 ;
	document.getElementById("rechts").style.width =c + 60 ;
	document.getElementById("rechts").style.top =52 ;
	document.getElementById("rechts").style.visibility = "visible";
	}
Info = document.getElementsByTagName("var")[0].firstChild;  //für counter
Info.data =+altcounter+"/"+(document.images.length-1)/2; 

}
 
function Layer1(zeig) 
{
  document.getElementById(altzeig).style.visibility = "hidden";
  document.getElementById(zeig).style.visibility = "visible";
  altzeig = zeig;
  xpos = findPosX(document.getElementById(altzeig));
}

function Layer2(bild) 
{
  document.getElementById(altbild).style.visibility = "hidden";
  document.getElementById(bild).style.visibility = "visible";
  altbild = bild;
  altcounter=bild.slice(4,altbild.length);
  Info = document.getElementsByTagName("var")[0].firstChild; 
  Info.data =+altcounter+"/"+(document.images.length-1)/2; 
}

function Layer3(icon) 
{
  document.getElementById(alticon).style.visibility = "hidden";
  document.getElementById(icon).style.visibility = "visible";
  alticon = icon;
}

function nach_links()
{
xpos = findPosX(document.getElementById(altzeig));
breite_div=document.getElementById("icons").offsetWidth + 30;
breite_screen=screen.availWidth-30;
b=breite_screen - breite_div;
if (a>b)
	{
	a-=2
	document.getElementById("icons").style.left = a;
	links=window.setTimeout ('nach_links()', 1);
	}
if (xpos<=30 && stopper ==0){stoppL();}
}

function nach_rechts()
{
xpos = findPosX(document.getElementById(altzeig));
if (a<30)
	{
	a+=2
	document.getElementById("icons").style.left = a;
	rechts=window.setTimeout ('nach_rechts()', 1);
	}
if (xpos >= screen.availWidth-120 && stopper ==0){stoppR();}
if (xpos >30 && stopper==0) {stoppR();}
}

function stoppL()
{
window.clearTimeout (links);
}

function stoppR()
{
window.clearTimeout (rechts);
}

function home()
{
 d=document.getElementById("inhalt").offsetWidth / 2;
 e=screen.availWidth / 2;
 g=e-d;
 document.getElementById("inhalt").style.left =g;
 document.getElementById("laufschrift").style.left = g;

}

function vita()
{
breite_text=document.getElementById("textvita").offsetWidth;
pos_x_text=document.getElementById("textvita").offsetLeft;
ziel1=0 - breite_text;
if (pos_x_text <= ziel1)
	{
	pos_x_text = 600;
	}
if (pos_x_text > ziel1)
	{
	pos_x_text-=1; 
	document.getElementById("textvita").style.left = pos_x_text;
	laufschr=window.setTimeout ('vita()', 1);
	}
}

function stop_vita()
{
clearTimeout (laufschr);
}



function home1()
{
o=document.getElementById("foto").offsetTop;
if (o<=-1340)
		{
		o=405;
		}
if (o>-1340)
	{
	o-=1
	document.getElementById("foto").style.top = o;
	oben=window.setTimeout ('home1()',20);
	}
}
function stop_home1()
{
clearTimeout (oben);
}

function clients_vita()
{
  document.getElementById("laufschrift").style.visibility = "hidden";
  document.getElementById("inhalt").style.visibility = "visible";
  document.getElementById("textvita").style.left = 600;
  stop_vita();
  stop_home1();
  home1();
}

function vita_clients()
{
document.getElementById("inhalt").style.visibility = "hidden";
document.getElementById("laufschrift").style.visibility = "visible";
document.getElementById("foto").style.top=405;
stop_vita();
stop_home1();
vita();
}


function play()
{
stopper=0;
zahl=altbild.slice(4,altbild.length);
foto="bild";
zeiger="zeig";
ic="icon";
zahl++;
	if (zahl>(document.images.length-1)/2)	
	{zahl=1;}
f=foto+zahl;
z=zeiger+zahl;
ico=ic+zahl;
Layer1(z);
Layer2(f);
Layer3(ico);
if (xpos > screen.availWidth-120)
	{
	stoppL();
	nach_links();
	} 
if (xpos<=30)
	{
	stoppR();
	nach_rechts();
	}
start=window.setTimeout('play()',4200);
}

function stopp()
{
window.clearTimeout(start);
stoppL();
stoppR();
stopper=1;
}

function play_stop()
{  document.getElementById("play").style.visibility = "hidden";
   document.getElementById("stopp").style.visibility = "visible";
   //document.getElementById("counter").style.visibility = "visible";
}
function stop_play()
{  document.getElementById("play").style.visibility = "visible";
   document.getElementById("stopp").style.visibility = "hidden";
   //document.getElementById("counter").style.visibility = "hidden";
}


function test() //kann weg
{
breite_text=document.getElementById("textvita").offsetWidth;
pos_x_text=document.getElementById("textvita").offsetLeft;
alert(breite_text);}

function findPosX(obj) {		
   var curleft = 0;
   if(obj.offsetParent) {
      while(obj.offsetParent) {
         curleft += obj.offsetLeft
         obj = obj.offsetParent;
      }
   }
   else if(obj.x) 
     curleft = obj.x;
   return curleft;
}

function eingabe()
{
	if (window.document.forms[0].nachname.value=="")
	{alert ("you must fill in : n a m e !"); window.document.forms[0].nachname.focus(); return false;}
	if (window.document.forms[0].e_mail.value=="")
	{alert ("You must fill in: e - m a i l !"); window.document.forms[0].e_mail.focus(); return false;}
	if (window.document.forms[0].nachricht.value=="")
	{alert ("You must fill in: m e s s a g e !"); window.document.forms[0].nachricht.focus(); return false;}
}

function blaetternPlus(){
zahl=altbild.slice(4,altbild.length);
foto="bild";
zeiger="zeig";
ic="icon";
zahl=++zahl;
if (zahl>(document.images.length-3)/2)	
	{zahl=1;}
f=foto+zahl;
z=zeiger+zahl;
ico=ic+zahl;
Layer1(z);
Layer2(f);
Layer3(ico);
}

function blaetternMinus(){
zahl=altbild.slice(4,altbild.length);
foto="bild";
zeiger="zeig";
ic="icon";
zahl=--zahl;
if (zahl<1)	
	{zahl=(document.images.length-3)/2;}
f=foto+zahl;
z=zeiger+zahl;
ico=ic+zahl;
Layer2(f);
Layer1(z);
Layer3(ico);
}
