neues_Fenster = null;

// ------------------------------------------------------------------------------------------   

function Zeigen(Bild0,Titel0,Breite0,Hoehe0)
{
   Bild = Bild0;
   Titel = Titel0;
   Breite = Breite0;
   Hoehe = Hoehe0;
   zu();
   setTimeout("sichtbar()",1000);
}

// ------------------------------------------------------------------------------------------   

function sichtbar()
{  
   Fenster_Hoehe  = Hoehe  + 30;
   Fenster_Breite = Breite + 40;
   links = (screen.width-Fenster_Breite)/2;
   oben  = (screen.height-Fenster_Hoehe)/2;

   Optionen = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,height='+Fenster_Hoehe+',width='+Fenster_Breite + ',left=' + links + ',top=' + oben;
   neues_Fenster = window.open('','',Optionen)
   with (neues_Fenster) 
   {
      document.writeln('<HTML><HEAD><TITLE>' + Titel + '</TITLE></HEAD>');
      document.writeln('<BODY BGCOLOR="#FFFFFF"><DIV ALIGN=CENTER><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 VALIGN="MIDDLE"><TR><TD>');
      document.writeln('<IMG SRC="'+Bild+'" WIDTH='+Breite+' HEIGHT='+Hoehe+' BORDER=0 ALT="'+Titel+'"></TD>');
      document.writeln('</TR></TABLE></DIV></BODY></HTML>');
   }
}

// ------------------------------------------------------------------------------------------   

function zu()
{  
   if (neues_Fenster != null)
     if (!neues_Fenster.closed)
       neues_Fenster.close();
}

// ------------------------------------------------------------------------------------------   

function ChangeSearchType(i)
{
  switch (i)
  { case 1: document.sform.artbez.checked=true;
            document.sform.eannr.checked=false;
            break
    case 2: document.sform.artbez.checked=false;
            document.sform.eannr.checked=true;
            break
  }
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.action = "search.php";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function Sakret(Seite)
{
  if (Seite == "produkte1")
   {
    document.sform.umi.value=1;
    if (document.sform.lmi) document.sform.lmi.value=1;
    document.sform.method = "post";
    document.sform.target = "_blank";
    document.sform.action = "produkte/artstruktur.php";
    document.sform.submit();
   }
  else
   { 
    document.sform.umi.value=1;
    if (document.sform.lmi) document.sform.lmi.value=1;
    document.sform.method = "post";
    document.sform.target = "_self";
    document.sform.action = Seite+".php";
    document.sform.submit();
   }
}

// ------------------------------------------------------------------------------------------   

function FindProduct()
{
 i=0;
 if ((document.sform.artbez) && (document.sform.artbez.checked)) i=1;
 if ((document.sform.eannr) && (document.sform.eannr.checked)) i=2;
 ChangeSearchType(i);
}

// ------------------------------------------------------------------------------------------   

lzg=-1;
function NextProduct(umi, umip, umib)
{
  document.sform.method = "post";
  document.sform.target = "_self";

  switch (umi)
  { case umip: if (document.sform.page) document.sform.page.value = "0";
               if (document.sform.lmi) document.sform.lmi.value = 0;
               break;
    case umib: if (document.sform.page) document.sform.page.value = "8";  
               if (document.sform.lmi) document.sform.lmi.value = 1;
               break;
  }

  document.sform.umi.value = umi;
  if (lzg==0) document.sform.action = 'products.php'+'?lzgebiet=0';
        else  document.sform.action = 'products.php';
  lzg=-1;
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function NextApplication(umi, umip, umiv, umih)
{
  document.sform.method = "post";
  document.sform.target = "_self";

  switch (umi)
  { case umip: if (document.sform.antw1) document.sform.antw1.value = 0;
               break;
    case umiv: if (document.sform.antw1) document.sform.antw1.value = 0;
               break;
    case umih: if (document.sform.antw1) document.sform.antw1.value = 0;  
               break;
  }
  if (document.sform.structure) document.sform.structure.value = 0;
  if (document.sform.lmi) document.sform.lmi.value = 0;
  if (document.sform.banwid) document.sform.banwid.value = 0;

  document.sform.umi.value = umi;
  if (lzg==0) document.sform.action = 'application.php'+'?lzgebiet=0';
        else  document.sform.action = 'application.php';
  lzg=-1;
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------

function NextSearch(umi, umip, umib)
{
  document.sform.method = "post";
  document.sform.target = "_self";

  switch (umi)
  { case umip: break;
    case umib: break;
  }
//  if (document.sform.lmi) document.sform.lmi.value = 0;

  document.sform.umi.value = umi;
  if (lzg==0) document.sform.action = 'search.php'+'?lzgebiet=0';
        else  document.sform.action = 'search.php';
  lzg=-1;
  document.sform.submit();
}
                                  
// ------------------------------------------------------------------------------------------   
                                  
function NextService(umi, umih, umiv, umib)
{
  document.sform.method = "post";
  document.sform.target = "_self";

//  if (document.sform.lmi) document.sform.lmi.value = 0;

  document.sform.umi.value = umi;
  if (lzg==0) document.sform.action = 'service.php'+'?lzgebiet=0';
        else  document.sform.action = 'service.php';
  lzg=-1;
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   
// B. Mueller
function CallSelfSchulungstermine(page)
{
  document.sform.page.value = page;
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.action = "schulungstermine.php";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function CallSchulungskategorien(page,id)
{
  document.sform.lmi.value = id;
  CallSelfSchulungstermine(page);
}

// ------------------------------------------------------------------------------------------   

function CallSelfProdukte(page)
{
  document.sform.page.value = page;
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.action = "products.php";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function CallSelf()
{
 window.location.reload();       // geht im firefox nicht ???  
}

// ------------------------------------------------------------------------------------------   

function FindNextAnswer(fr)
{
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.mfr.value=fr;
  document.sform.action = "application.php";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function show_structure()
{
  document.sform.structure.value = 1;
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.action = "application.php";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function SetHL(id,anz)
{
   for (i=1; i<=anz; i++)
   { idname="td"+i;
     if (document.getElementById(idname)) 
     { docid=document.getElementById(idname);
       if ((i==id) || (document.sform.lmi.value==i)) docid.className ="lmenu_hilite";
                                                else docid.className ="lmenu_option";
     }                                           
   }
}

// ------------------------------------------------------------------------------------------   

function SetO(id)
{
  idname="td"+id;
  docid=document.getElementById(idname);
  if (document.sform.lmi.value!=id) docid.className ="lmenu_option";
}

// ------------------------------------------------------------------------------------------   

function CallPG(page,id)
{
  document.sform.lmi.value = id;
  CallSelfProdukte(page);
}

// ------------------------------------------------------------------------------------------   

function FindNA(id)
{
  document.sform.lmi.value = id;
  FindNextAnswer(0);
}
// ------------------------------------------------------------------------------------------   

function SetLG(hmi,hmip,hmia,hmis,hmiu,umi,lg)
{ 
  switch (hmi)
  { case hmip: document.sform.action = "products.php?lzgebiet="+lg;
               break; 
	case hmia: document.sform.action = "application.php?lzgebiet="+lg;
	           break;
	case hmis: document.sform.action = "service.php?lzgebiet="+lg;
	           break;
	case hmiu: document.sform.action = "search.php?lzgebiet="+lg;
	           break;
  }
  document.sform.umi.value = umi;
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function CallPage(ns,page)
{
  document.sform.action = ns;
  document.sform.lmi.value = page;
  document.sform.umi.value = page;
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function show_apdata()
{
  alert('Hier fehlen noch Daten !');
}

// ------------------------------------------------------------------------------------------   

function ViewP(PId)
{ 
  Seite="pview.php?Produkt="+PId+"&sid="+document.sform.sid.value; 
  Optionen = 'height=500, width=500, resizable=yes, scrollbars=yes'; 
  ////screenX=50, screenY=50, toolbar=0,location=0,directories=0,status=0,menubar=0,
  neues_Fenster = window.open(Seite,'',Optionen);
}

// ------------------------------------------------------------------------------------------   

function change_LZG(hmi,hmiP,hmiA,hmiS,hmiU,umi,umiPP,umiPB,umiAP,umiAV,umiAH,umiSH,umiSV,umiSB,umiUP,umiUB)
{ 
  lzg=0; 
  switch (hmi)
  { case hmiP: NextProduct(umi,umiPP,umiPB);
               break;
    case hmiA: NextApplication(umi,umiAP,umiAV,umiAH);
               break;
    case hmiS: NextService(umi,umiSH,umiSV,umiSB); 
               break;
    case hmiU: NextSearch(umi,umiUP,umiUB); 
               break;
  }              
}

// ------------------------------------------------------------------------------------------   

function ViewI(m1,m2,us)
{ 
  Seite="seite.php?EbeneM1="+m1+"&EbeneM2="+m2+"&ITyp="+us; 
  Optionen = 'height=500, width=650, left=100, top=100, resizable=yes, scrollbars=yes, menubar=1'; 
  ////screenX=50, screenY=50, toolbar=0,location=0,directories=0,status=0,menubar=0,
  neues_Fenster = window.open(Seite,'',Optionen);
}

// ------------------------------------------------------------------------------------------   

function NachrichtSenden(afaus,betreff) // am 14.04.2008 um "betreff" erweitert
{ 
  vorname   = trim(document.sform.vorname.value);
  nachname  = trim(document.sform.nachname.value);
  firma     = trim(document.sform.firma.value);
  strasse   = trim(document.sform.strasse.value);
  staat     = trim(document.sform.staat.value);  
  plzm      = trim(document.sform.plzm.value);          
  ort       = trim(document.sform.ort.value);
  telefon   = trim(document.sform.telefon.value);
  email     = trim(document.sform.email.value);
  nachricht = trim(document.sform.nachricht.value);
  if (
      (vorname  == '') ||
      (nachname == '') ||
      (strasse  == '') ||
      (staat    == '') ||  
      (plzm     == '') ||           
      (ort      == '') ||
      (telefon  == '') ||
      (nachricht== '')
     ) 
     alert(afaus); // Achtung','Bitte alle Felder ausfüllen.
  else
  {    
   Seite="inc/cmail.php";
   //Seite = Seite + "?sid="      + document.sform.sid.value;
   Seite = Seite + "?vorname="  + vorname; 
   Seite = Seite + "&nachname=" + nachname; 
   Seite = Seite + "&firma="    + firma;
   Seite = Seite + "&strasse="  + strasse;
   Seite = Seite + "&staat="    + staat;  
   Seite = Seite + "&plz="      + plzm;           
   Seite = Seite + "&ort="      + ort;
   Seite = Seite + "&telefon="  + telefon;
   Seite = Seite + "&email="    + email;
   nachricht = document.sform.nachricht.value;
   while (nachricht.indexOf("\n")>-1) nachricht=nachricht.replace("\n","@@@");

   Seite = encodeURI(Seite + "&betreff=" + betreff + "&nachricht=" + nachricht);

   Optionen = 'height=320, width=320, left=100, top=100, resizable=yes, scrollbars=yes'; 
   nF = window.open(Seite,'',Optionen);
//   nF.setTimeout('window.close()',10000);
  }
}

// ------------------------------------------------------------------------------------------   
function wechsle_wdvs()
{
	if (document.sform.WDVS.checked == true)
	{
      var deaktiviert = false;
    } 
	else 
	{
      var deaktiviert = true;
	}
    for (var i = 0; i < document.sform.WDVSSchulung.length; i++) 
	{
       document.sform.WDVSSchulung[i].disabled = deaktiviert;
    } 
}

// ------------------------------------------------------------------------------------------   
function wechsle_fliese()
{
	if (document.sform.FLIESE.checked == true)
	{
      var deaktiviert = false;
    } 
	else 
	{
      var deaktiviert = true;
	}
    for (var i = 0; i < document.sform.FLIESESchulung.length; i++) 
	{
       document.sform.FLIESESchulung[i].disabled = deaktiviert;
    } 
}

// ------------------------------------------------------------------------------------------   

function SchulungsanmeldungSenden(afaus)
{ 
  if ((document.sform.WDVS.checked == false) && (document.sform.FLIESE.checked == false))
   {
      alert("Wählen Sie bitte einen Schulungstermin");  // Achtung','Bitte alle Felder ausfüllen.
	  return;   
   }

  if (
      (document.sform.vorname.value=='')||
      (document.sform.nachname.value=='')||
      (document.sform.strasse.value=='')||
      (document.sform.staat.value=='')||  
      (document.sform.plzm.value=='')||           
      (document.sform.ort.value=='')||
      (document.sform.telefon.value=='')||
      (document.sform.email.value=='')
     ) 
     alert(afaus);  // Achtung','Bitte alle Felder ausfüllen.
  else
  { 
  // E-Mail-Link überprüfen
  s = document.sform.email.value;
  s.toLowerCase();
  if (!CheckEMail(s))
  {
    alert('Sie müssen eine gültige Mail-Adresse eingeben!');
    document.sform.email.focus();
    return;    
  }   
   Seite="inc/schulungsanmeldung_mail.php";
   Seite=Seite+"?sid="+document.sform.sid.value;
     
   sWDVSTermin = "";
   if (document.sform.WDVS.checked == true)
   {
    for (var i = 0; i < document.sform.WDVSSchulung.length; i++) 
	{
       if (document.sform.WDVSSchulung[i].checked == true)
	   {
		  sWDVSTermin = document.sform.WDVSSchulung[i].value 
	   }
    }
   }
   sFLIESETermin = "";
   if (document.sform.FLIESE.checked == true)
   {
    for (var i = 0; i < document.sform.FLIESESchulung.length; i++) 
	{
       if (document.sform.FLIESESchulung[i].checked == true)
	   {
		  sFLIESETermin = document.sform.FLIESESchulung[i].value 
	   }
    }
   }

   Seite=Seite+"&schulungWDVS="+sWDVSTermin; 
   Seite=Seite+"&schulungFLIESE="+sFLIESETermin; 
   Seite=Seite+"&vorname="+document.sform.vorname.value; 
   Seite=Seite+"&nachname="+document.sform.nachname.value; 
   Seite=Seite+"&firma="+document.sform.firma.value;
   Seite=Seite+"&strasse="+document.sform.strasse.value;
   Seite=Seite+"&staat="+document.sform.staat.value;  
   Seite=Seite+"&plz="+document.sform.plzm.value;           
   Seite=Seite+"&ort="+document.sform.ort.value;
   Seite=Seite+"&tel="+document.sform.telefon.value;
   Seite=Seite+"&email="+document.sform.email.value;
   nachricht=document.sform.nachricht.value;
   while (nachricht.indexOf("\n")>-1) nachricht=nachricht.replace("\n","@@@");
   Seite=Seite+"&nachricht="+nachricht;
   Optionen = 'height=500, width=500, left=100, top=100, resizable=yes, scrollbars=yes'; 
   nF = window.open(Seite,'',Optionen);
  }
}

// ------------------------------------------------------------------------------------------   

function NewsletterSenden()
{ 
  s = trim(document.sform.nachname.value);
  if (s=='')
  {
    alert('Der Nachname ist ein Pflichtfeld');
    document.sform.nachname.focus();
    return;
  }

  s = trim(document.sform.email.value);
  if (s=='')
  {
    alert('Die E-Mail-Adresse ist ein Pflichtfeld');
    document.sform.email.focus();
    return;
  }

  // E-Mail-Link überprüfen
  s.toLowerCase();
  if (!CheckEMail(s))
  {
    alert('Sie müssen eine gültige Mail-Adresse eingeben!');
    document.sform.email.focus();
    return;    
  }

  if (document.sform.newsab.checked==true) 
  {
    newsab = 1;
  }
  else
  {
    newsab = 0;
  }   
  Seite = "inc/newsletter_mail.php";
  Seite = Seite + "?sid="      + document.sform.sid.value; 
  Seite = Seite + "&newsab="   + newsab;
  Seite = Seite + "&vorname="  + document.sform.vorname.value; 
  Seite = Seite + "&nachname=" + document.sform.nachname.value; 
  Seite = Seite + "&firma="    + document.sform.firma.value;
  Seite = Seite + "&strasse="  + document.sform.strasse.value;
  Seite = Seite + "&staat="    + document.sform.staat.value;  
  Seite = Seite + "&plz="      + document.sform.plzm.value;           
  Seite = Seite + "&ort="      + document.sform.ort.value;
  Seite = Seite + "&tel="      + document.sform.telefon.value;
  Seite = Seite + "&email="    + document.sform.email.value;
  //Seite = Seite+"&nachricht="+nachricht;
  Optionen = 'height=500, width=500, left=100, top=100, resizable=yes, scrollbars=yes'; 
   ////screenX=50, screenY=50, toolbar=0,location=0,directories=0,status=0,menubar=0,
  //alert(Seite);
  //alert(Optionen); 
  nF = window.open(Seite,'',Optionen);
//   nF.setTimeout('window.close()',10000);
}

// ------------------------------------------------------------------------------------------   

function CallService()
{
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.action = "service.php";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function FindAB(anwid,id)
{
  if (id>0) document.sform.lmi.value = id;
  document.sform.banwid.value = anwid;
  document.sform.method = "post";
  document.sform.target = "_self";
  document.sform.action = "application.php";
  document.sform.submit();
}

// ------------------------------------------------------------------------------------------   

function PView(PTyp,lfdnr)
{ 
  Seite="pview.php?ptyp="+PTyp+"&nr="+lfdnr; 
  Optionen = 'height=700, width=650, left=100, top=100, resizable=yes, scrollbars=yes, menubar=1'; 
  ////screenX=50, screenY=50, toolbar=0,location=0,directories=0,status=0,menubar=0,
  neues_Fenster = window.open(Seite,'',Optionen);
}

// ------------------------------------------------------------------------------------------   

function bw_on()
{
  document.getElementById("bw").style.display = "inline";
//   document.getElementById("bw").style.visibility = "visible";
  document.body.style.cursor = "wait";
}

// ------------------------------------------------------------------------------------------   

function bw_off()
{
  document.getElementById("bw").style.display = "none";
//  document.getElementById("bw").style.visibility = "hidden";
  document.body.style.cursor = "default";
}

// ------------------------------------------------------------------------------------------   

function act3_off()
{
  if (document.getElementById("act3")) document.getElementById("act3").style.display = "none";
}

// ------------------------------------------------------------------------------------------   

function shop()
{ 
  Seite="http://www.sakret.de/shop"; 
  Optionen = 'scrollbars=yes, menubar=yes, toolbar=yes, status=yes, resizable=yes, top=0px, left=0px'; 
  neues_Fenster = window.open(Seite,'sakwin',Optionen);
}

// ------------------------------------------------------------------------------------------   

function NachOben()
{
 while(document.body.scrollTop > 0) window.scrollBy(0,-100);
}

