var centerit;
var win_h;
var win_w;
var posx;
var posy;
var faktorx=2;
var faktory=2;

var old;
var memold;
var s_color='#BE9560';
var d_color='#EBC793';
var m_color='#0099ff';
var layer_webp="entry";
var ds_tabx="tabpak1a";var ds_taby="tabpak1b";
var buffercolor="#ffffff";
var ptabselect=1;
var site="";
var tab3='tab3x';
var tab4='tab4x';
var tab5='tab5x';
var close='close';

function start()
{
 centerit=eval(document.getElementById("Centerit"));
 if(window.innerWidth)
   {
    win_h=window.outerHeight;
    win_w=window.innerWidth;
   }
   else 
   {
    win_h=document.body.offsetHeight;
    win_w=document.body.offsetWidth;
   }
	 posx=(win_w-820)/faktorx;if(posx<=0){posx=0;}
	 posy=0;
	 centerit.style.position ="absolute";
   centerit.style.left=posx;
   centerit.style.top=posy;
}

function show_layer(x)
{
 if (document.getElementById(x)){
     document.getElementById(x).style.visibility="visible";}
}
function hide_layer(x)
{
	if (document.getElementById(x)){
        document.getElementById(x).style.visibility="hidden";}
}

function do_menu(x)
{
 if(x==close)
  {
   hide_layer(tab3);
	 hide_layer(tab4);
   hide_layer(tab5);
  }
 if (x!=close)
 {
   show_layer(x);
 if(x==tab3)
	   {
      hide_layer(tab4);
			hide_layer(tab5);
		 }
   if(x==tab4)
	   {
      hide_layer(tab3);
			hide_layer(tab5);
		}
	if(x==tab5)
	   {
      hide_layer(tab3);
			hide_layer(tab4);
		 }
  }
}

function tableave(tab)
{
  document.getElementById(tab).style.visibility="hidden";
	old="";
}
function tabenter(tab)
{
  document.getElementById(tab).style.visibility="visible";
	old=tab;
}

function select(x)
{
  if (document.getElementById(x)){
   document.getElementById(x).style.backgroundColor=s_color;}
}
function deselect(x)
{
  if (document.getElementById(x)){
	 document.getElementById(x).style.backgroundColor=d_color;
     }
}
function selecttab(x,y,z)
{
  
  if (document.getElementById(x)){
     document.getElementById(ds_tabx).style.backgroundColor=d_color;// alte Farbe bei alten Select herstellen
     document.getElementById(ds_taby).style.backgroundColor=d_color;// dito
     document.getElementById(x).style.backgroundColor=s_color;// neue Farbe
     document.getElementById(y).style.backgroundColor=s_color;// dito
     document.getElementById(layer_webp).style.visibility="hidden";
     document.getElementById(z).style.visibility="visible";
     }

}
function deselecttab(x,y,z)
{
  layer_webp=z;
  ds_tabx=x;
  ds_taby=y;
}
     
function selectfont(x,color)
{
if(x!=site)
 {
  if (document.getElementById(x)){
    buffercolor=document.getElementById(x).style.color;
    document.getElementById(x).style.color=color;} 
 }
}
function deselectfont(x,color)
{
if(x!=site)
 {
  if (document.getElementById(x)){
     document.getElementById(x).style.color=color;}
  }
}

function changeList(list)
{
 if (list==0){
 document.getElementById("preisliste2").style.visibility="visible";
 document.getElementById("preisliste2").style.visibility="hidden";
 document.getElementById("preisliste1").style.visibility="visible";
 selectfont('s1','#ffaa00');
 }
 if (list==1){
	   document.getElementById("preisliste2").style.visibility="hidden";
     document.getElementById("preisliste1").style.visibility="visible";
		 selectfont('s1','#ffaa00');
		 deselectfont("s2",'#ffffff');
		 ptabselect=1;
		 }
 if (list==2){
	   document.getElementById("preisliste1").style.visibility="hidden";
     document.getElementById("preisliste2").style.visibility="visible";
		 selectfont('s2','#ffaa00');
		 deselectfont("s1",'#ffffff');
		 ptabselect=2;
		 }
if (list==3){
		 selectfont('s1','#ffff00');
		}
if (list==4){
     if(ptabselect==1){
		 deselectfont('s1','#ffaa00');}
		 else {
		 deselectfont('s1','#ffffff');}
		}
if (list==5){
		 selectfont('s2','#ffff00');
		}
if (list==6){
     if(ptabselect==2){
		 deselectfont('s2','#ffaa00');}
		 else {
		 deselectfont('s2','#ffffff');}
		}
}

function checkName(s)
{
  site=s;
  if (document.getElementById(s)){
      document.getElementById(site).style.color=m_color;}
}
function mailalarm()
{ 
  
  checkalarm();
  if (eingaben==false)
	{
  return false;}
  if(eingaben==true){
	 document.kontaktmail.checkit.value=1;
	 
   alert("Vielen Dank für Ihre Anfrage !");
 return true;}
}
function checkalarm()
{

   if(document.kontaktmail.nachname.value == "")
      {
       alert("Bitte Ihren Nachnamen eingeben!");
       document.kontaktmail.nachname.focus();
       eingaben=false;
      }
    else if(document.kontaktmail.email.value == "")
      {
       alert("Bitte Ihre e-mail angeben!");
       document.kontaktmail.email.focus();
       eingaben=false;
      }
    else if(document.kontaktmail.anfrage.value == "")
      {
       alert("Bitte Ihre Anfrage eingeben!");
       document.kontaktmail.anfrage.focus();
       eingaben=false;
      }
     else {
			     eingaben=true;}
}

