var ie= ((document.all)&&(!document.layers)) ? true : false;
var ns= ((document.layers)&&(!document.getElementById)) ? true : false;
var moz= ((document.getElementById)&&(!document.all)) ? true : false;

function MenueAuf(div) {
if(ie){
document.all[div].style.visibility="visible";
}
if(ns){
document.layers[div].visibility="show";
}
if(moz){
document.getElementById(div).style.visibility="visible";
}
}

function MenueZu(div) {
if(ie) {document.all[div].style.visibility="hidden";}
if(ns) {document.layers[div].visibility="hide";}
if(moz) {document.getElementById(div).style.visibility="hidden";}
}

var group_id;
var openfreshdeal=0;

function loadSubGroup(nr,id)
{
   group_id=id;

   for(var i=1; i<=4; i++)
   {
     if(nr==i) document.getElementById('group'+i).innerHTML='<img src="images/sublink'+i+'a.gif" alt="" />';
     else document.getElementById('group'+i).innerHTML='<img src="images/sublink'+i+'.gif" alt="" />';
   }

   if(id==133) document.getElementById('produktseite').style.minHeight="340px";
   else document.getElementById('produktseite').style.minHeight="460px";

   if(nr==4) document.getElementById('to_go').innerHTML='';
   else document.getElementById('to_go').innerHTML='<img src="images/Tutto_to_go.jpg" alt="" />';

   function ausgeben() {
       if (http.readyState == 4) {
          var inhalt = http.responseText;
          var array = inhalt.split ('^');

          document.getElementById("sublinks2").innerHTML=array[0];
          document.getElementById("sublinks3").innerHTML=array[1];
          document.getElementById("subbild2").src='./cms/subs/'+array[2];
          }
    }

    var http = null;
    if (window.XMLHttpRequest) {
       http = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
       http = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (http != null) {
       http.open("GET", "subs.php?group_id="+group_id+"&aktion=getgroup&random="+Math.random(), true);
       http.onreadystatechange = ausgeben;
       http.send(null);
    }
}

function openFreshdeal()
{
  if(openfreshdeal==1) document.location.href="freshdealcard.php";
  else if(openfreshdeal==2) window.open("gutschein_print.php" , "gutschein", "width=550,height=320,left=50,top=50,scrollbars=no,menubar=no,resizable=no,locationbar=no");
}

function loadProdukt(nr,id)
{
   group_id=id;
   if(id==130) var vz="sweets";
   else if(id==128) var vz="salate";
   else if(id==129) var vz="suppen";
   else if(id==131) var vz="drinks";
   else if(id==132) var vz="specials";
   else var vz="subs";

   function ausgeben2() {
       if (http.readyState == 4) {
          var inhalt = http.responseText;
          var array = inhalt.split ('^');

          if(id==131 || id==132 || id==130 || id==129 || id==128)
          {
             document.getElementById("sublinks1b").innerHTML=array[0];
             if(id!=132) document.getElementById("sublinks2b").innerHTML=array[1];
          }
          else
          {
             document.getElementById("sublinks2").innerHTML=array[0];
             document.getElementById("sublinks3").innerHTML=array[1];
          }

          //Subs - Specials Bild im Hintergrund für dyn.Text im Vordergrund
          if(id==132)
          {
            document.getElementById("sublinks2b").style.top='29px';
            document.getElementById("sublinks2b").style.left='364px';

            if(array[2]=="gutschein_banner2011.jpg" || array[2]=="gutschein_banner2012.jpg")
            {
              document.getElementById("sublinks2b").style.cursor="";
              document.getElementById("sublinks2b").innerHTML=document.getElementById("gutschein").innerHTML;
              document.getElementById("sublinks2b").style.backgroundImage='';
            }
            else if(array[2]=="Sonderwochen.jpg")
            {
              document.getElementById("sublinks2b").style.cursor="";
              document.getElementById("sublinks2b").innerHTML=document.getElementById("sonderwochen").innerHTML;
              document.getElementById("sublinks2b").style.backgroundImage='';
            }
            else if(array[2]=="FreshDeal.jpg")
            {
              document.getElementById("sublinks2b").style.cursor="pointer";
              document.getElementById("sublinks2b").innerHTML=document.getElementById("freshdealcode").innerHTML;
              openfreshdeal=1;
              document.getElementById("sublinks2b").style.backgroundImage='url(cms/'+vz+'/'+array[2]+')';
            }
            else if(array[2]=="ContentBanner_2_fuer.jpg")
            {
              document.getElementById("sublinks2b").style.cursor="pointer";
              document.getElementById("sublinks2b").innerHTML="";
              openfreshdeal=2;
              document.getElementById("sublinks2b").style.backgroundImage='url(cms/'+vz+'/'+array[2]+')';
            }
            else
            {
              document.getElementById("sublinks2b").style.cursor="";
              document.getElementById("sublinks2b").innerHTML="";
              openfreshdeal=0;
              document.getElementById("sublinks2b").style.backgroundImage='url(cms/'+vz+'/'+array[2]+')';
            }
          }
          else if(array[2]) document.getElementById("subbild2").src='./cms/'+vz+'/'+array[2];
          else document.getElementById("subbild2").src='';
       }
    }

    var http = null;
    if (window.XMLHttpRequest) {
       http = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
       http = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (http != null) {
       http.open("GET", "subs.php?group_id="+group_id+"&nr="+nr+"&aktion=getprodukt&random="+Math.random(), true);
       http.onreadystatechange = ausgeben2;
       http.send(null);
    }
}

function loadJobGroup(nr,id)
{
   group_id=id;

   for(var i=1; i<=2; i++)
   {
     if(nr==i) document.getElementById('group'+i).style.textDecoration='bold';
     else document.getElementById('group'+i).style.textDecoration='none';
   }

   function ausgeben() {
       if (http.readyState == 4) {
          var inhalt = http.responseText;
          var array = inhalt.split ('^');

          document.getElementById("joblinks2").innerHTML=array[0];
          document.getElementById("joblinks3").innerHTML=array[1];
          }
    }

    var http = null;
    if (window.XMLHttpRequest) {
       http = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
       http = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (http != null) {
       http.open("GET", "karriere.php?group_id="+group_id+"&aktion=getjobs&random="+Math.random(), true);
       http.onreadystatechange = ausgeben;
       http.send(null);
    }
}

function loadJob(nr,id)
{
   group_id=id;

   function ausgeben2() {
       if (http.readyState == 4) {
          var inhalt = http.responseText;
          var array = inhalt.split ('^');

          document.getElementById("joblinks2").innerHTML=array[0];
          document.getElementById("joblinks3").innerHTML=array[1];
       }
    }

    var http = null;
    if (window.XMLHttpRequest) {
       http = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
       http = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (http != null) {
       http.open("GET", "karriere.php?group_id="+group_id+"&nr="+nr+"&aktion=getjobdetails&random="+Math.random(), true);
       http.onreadystatechange = ausgeben2;
       http.send(null);
    }
}

function loadDownload(nr,id)
{
   group_id=id;

   for(var i=1; i<=2; i++)
   {
     if(nr==i) document.getElementById('group'+i).style.textDecoration='bold';
     else document.getElementById('group'+i).style.textDecoration='none';
   }

   function ausgeben() {
       if (http.readyState == 4) {
          var inhalt = http.responseText;
          document.getElementById("downloadlinks2").innerHTML=inhalt;
          }
    }

    var http = null;
    if (window.XMLHttpRequest) {
       http = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
       http = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (http != null) {
       http.open("GET", "downloads.php?group_id="+group_id+"&aktion=getdownload&random="+Math.random(), true);
       http.onreadystatechange = ausgeben;
       http.send(null);
    }
}

function emediagroup_form(theForm)
{

  if (theForm.vorname.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Vorname\" ein.");
    theForm.vorname.focus();
    return (false);
  }

  if (theForm.nachname.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Nachname\" ein.");
    theForm.nachname.focus();
    return (false);
  }

  if (theForm.strasse.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Straße\" ein.");
    theForm.strasse.focus();
    return (false);
  }

  if (theForm.plz.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"PLZ\" ein.");
    theForm.plz.focus();
    return (false);
  }

  if (theForm.ort.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Ort\" ein.");
    theForm.ort.focus();
    return (false);
  }
  if (theForm.birthday.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Geburtsdatum\" ein.");
    theForm.birthday.focus();
    return (false);
  }

  if (theForm.schule.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Schule\" ein.");
    theForm.schule.focus();
    return (false);
  }

  if (theForm.matrikelnr.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Matrikel- / Ausweisnummer\" ein.");
    theForm.matrikelnr.focus();
    return (false);
  }


  if (theForm.handy.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Handynummer\" ein.");
    theForm.handy.focus();
    return (false);
  }

    if(theForm.email.value.indexOf('@') == -1)

  {
    alert("Keine gültige E-Mail-Adresse!");
    theForm.email.focus();
    return (false);
  }

}

function checkInfobroschuere(theForm)
{

  if (theForm.Vorname.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Vorname\" ein.");
    theForm.Vorname.focus();
    return (false);
  }

  if (theForm.Nachname.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Nachname\" ein.");
    theForm.Nachname.focus();
    return (false);
  }

  if (theForm.Strasse.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Straße\" ein.");
    theForm.Strasse.focus();
    return (false);
  }

  if (theForm.Nr.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Nr\" ein.");
    theForm.Nr.focus();
    return (false);
  }

  if (theForm.PLZ.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"PLZ\" ein.");
    theForm.PLZ.focus();
    return (false);
  }

  if (theForm.Ort.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Ort\" ein.");
    theForm.Ort.focus();
    return (false);
  }
  if (theForm.Telefon.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Telefon\" ein.");
    theForm.Telefon.focus();
    return (false);
  }

  if(theForm.Email.value.indexOf('@') == -1)
  {
    alert("Keine gültige E-Mail-Adresse!");
    theForm.Email.focus();
    return (false);
  }

}


 function checkKontakt(theForm)
  {
      if (theForm.Vorname.value == "")
      {
        alert("Geben Sie einen Wert in das Feld \"Vorname\" ein.");
        theForm.Vorname.focus();
        return (false);
      }

      if (theForm.Nachname.value == "")
      {
        alert("Geben Sie einen Wert in das Feld \"Nachname\" ein.");
        theForm.Nachname.focus();
        return (false);
      }

      if (theForm.Strasse.value == "")
      {
        alert("Geben Sie einen Wert in das Feld \"Straße\" ein.");
        theForm.Strasse.focus();
        return (false);
      }

      if (theForm.PLZ.value == "")
      {
        alert("Geben Sie einen Wert in das Feld \"PLZ\" ein.");
        theForm.PLZ.focus();
        return (false);
      }

      if (theForm.Ort.value == "")
      {
        alert("Geben Sie einen Wert in das Feld \"Ort\" ein.");
        theForm.Ort.focus();
        return (false);
      }

      if (theForm.Telefon.value == "")
      {
        alert("Geben Sie einen Wert in das Feld \"Telefon\" ein.");
        theForm.Telefon.focus();
        return (false);
      }

      if (theForm.Nachricht.value == "")
      {
        alert("Geben Sie einen Wert in das Feld \"Nachricht\" ein.");
        theForm.Nachricht.focus();
        return (false);
      }
      return (true);
  }


