/* —————————————————————————————————————————————————————————————————————————————— *
 *  tools.js 
 * —————————————————————————————————————————————————————————————————————————————— */
  function MM_preloadImages() 
  { 
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  }

  function MM_swapImgRestore() 
  {
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  }

  function MM_findObj(n, d) 
  { 
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
  }

  function MM_swapImage() 
  { 
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  }
  
  var oldProductAmountString;
  function checkAmountInput(obj)
  {
    var text = obj.value;
    if(isNaN(text)==true)
    {
      obj.value = oldProductAmountString;
    }
    else
    {
      oldProductAmountString = text;
      if(text=="" || text=="undefined")
      {
        text="";
      }
    }    
  }
  
  function AddToFavorites(url,title) 
  { 
    if (window.sidebar) // Mozilla Firefox Bookmark		
    { 
      window.sidebar.addPanel(title, url,"");	
    } 
    else if(window.external)  // IE Favorite		
    { 
      window.external.AddFavorite( url, title); 
    }	
    else if(window.opera && window.print) // Opera Hotlist		
    { 
      return true; 
    } 
  }
/* ------------------------------------------------------------------------------ */
  function checkForm() 
  {
    if ((document.kontform.name.value == ""))
    {
      alert("Bitte geben Sie Ihren Namen ein.");
      return false;
    }
    document.kontform.submit();
    return true;
  }
/* ------------------------------------------------------------------------------ */
  function statusText(text)
  {
    name1=text;
    setTimeout("window.status=name1;",0.1);
    return true;
  }
/* ------------------------------------------------------------------------------ */
  function hoverIE() 
  {
    if (navigator.userAgent.indexOf("MSIE 6") != -1)
    {      
      if(window.navigator.systemLanguage && !window.navigator.language) 
      {
        var LI = document.getElementById("mainNav").firstChild;
        do 
        {
          if (sucheUL(LI.firstChild)) 
          {
            LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
          }
          LI = LI.nextSibling;
        }
        while(LI);
      }
    }
  }
/* ------------------------------------------------------------------------------ */
  function sucheUL(UL)
  {      
    do 
    {
      if(UL) UL = UL.nextSibling;
      if(UL && UL.nodeName == "UL") return UL;
    }
    while(UL);
    return false;
  }
/* ------------------------------------------------------------------------------ */
  function einblenden()
  {
    var UL = sucheUL(this.firstChild);
    UL.style.visibility = "visible";
    var hoehe = UL.offsetHeight;
    if(hoehe < 0)
      hoehe = 0
    if(this.childNodes[2] != null)
    {
      this.childNodes[2].style.display = "block";
      this.childNodes[2].style.height = hoehe + "px";
    }
  }
/* ------------------------------------------------------------------------------ */
  function ausblenden() 
  {
    sucheUL(this.firstChild).style.visibility = "hidden";
    if(this.childNodes[2] != null)
      this.childNodes[2].style.display = "none";
  }


/*- Alle Felder ausgefüllt? ----------------------------------------------------------- */
function checkLoginandPW(language)
{

  if (document.loginform.vorname.value == "" || document.loginform.nachname.value == "" ||
      document.loginform.strasse.value == "" || document.loginform.plz.value == "" ||
      document.loginform.ort.value == "" || document.loginform.tel.value == "" || document.loginform.email.value == "" || document.loginform.land.value.indexOf("-") == 0) 
  {
    switch (language)
    {
      case "de": { alert("Überprüfen Sie ihre Eingaben! Alle mit * gekennzeichneten Felder müssen ausgefüllt werden!"); break }
      case "en": { alert("Überprüfen Sie ihre Eingaben! Alle mit * gekennzeichneten Felder müssen ausgefüllt werden!"); break }
      case "fr": { alert("Check your Inputs! All with * characterized fields habe to be filled out!"); break }
      case "it": { alert("Check your Inputs! All with * characterized fields habe to be filled out!"); break }
    }
    document.loginform.vorname.focus(); 
    return false;
  }
  else
  {  
    if (document.loginform.pw.value != "" || document.loginform.pw2.value == " ")
    {
      if (document.loginform.pw.value != document.loginform.pw2.value)
      {
        switch (language)
        {
          case "de": { alert("Das Passwort und die Passwortbestätigung stimmen nicht überein"); break }
          case "en": { alert("The password and the password confirmation do not agree"); break }
          case "fr": { alert("The password and the password confirmation do not agree"); break }
          case "it": { alert("The password and the password confirmation do not agree"); break }
        }
        document.loginform.pw.focus();
        return false;
      }
      else
      {
        if (document.loginform.pw.value.length < 6)
        {
          switch (language)
          {
            case "de": { alert("Das Passwort muss aus mindestens 6 Zeichen bestehen!"); break }
            case "en": { alert("The password must consist of at least 6 indications!"); break }
            case "fr": { alert("The password must consist of at least 6 indications!"); break }
            case "it": { alert("The password must consist of at least 6 indications!"); break }
          }
          document.loginform.pw.focus();
          return false;
        }
        else
        {
          document.loginform.submit();
        }
      }
    }
    else
    {
      switch (language)
      {
        case "de": { alert("Geben Sie ein Passwort und die Passwortbestätigung ein!"); break }
        case "en": { alert("Enter a password and the password confirmation"); break }
        case "fr": { alert("Enter a password and the password confirmation"); break }
        case "it": { alert("Enter a password and the password confirmation"); break }
      }
      document.loginform.pw.focus();
      return false;
    }
  }
}

/*- Alle Felder ausgefüllt? Passwort=Zufall, wenn nicht ausgefüllt--------------------- */
function checkLoginandPWZufall(language)
{
  if (document.loginform.vorname.value == "" || document.loginform.nachname.value == "" ||
      document.loginform.strasse.value == "" || document.loginform.plz.value == "" ||
      document.loginform.ort.value == "" || document.loginform.tel.value == "" || document.loginform.email.value == "" || document.loginform.land.value.indexOf("-") == 0
     )
  {
    switch (language)
    {
      case "de": { alert("Überprüfen Sie ihre Eingaben! Alle mit * gekennzeichneten Felder müssen ausgefüllt werden!"); break }
      case "en": { alert("Check your Inputs! All with * characterized fields habe to be filled out!"); break }
      case "fr": { alert("Check your Inputs! All with * characterized fields habe to be filled out!"); break }
      case "it": { alert("Check your Inputs! All with * characterized fields habe to be filled out!"); break }
    }
    document.loginform.vorname.focus(); 
    return false;
  }
  else
  {  
    if (document.loginform.pw.value != "" || document.loginform.pw2.value == " ")
    {
      if (document.loginform.pw.value != document.loginform.pw2.value)
      {
        switch (language)
        {
          case "de": { alert("Das Passwort und die Passwortbestätigung stimmen nicht überein"); break }
          case "en": { alert("The password and the password confirmation do not agree"); break }
          case "fr": { alert("The password and the password confirmation do not agree"); break }
          case "it": { alert("The password and the password confirmation do not agree"); break }
        }
        document.loginform.pw.focus();
        return false;
      }
      else
      {
        if (document.loginform.pw.value.length < 6)
        {
          switch (language)
          {
            case "de": { alert("Das Passwort muss aus mindestens 6 Zeichen bestehen!"); break }
            case "en": { alert("The password must consist of at least 6 indications!"); break }
            case "fr": { alert("The password must consist of at least 6 indications!"); break }
            case "it": { alert("The password must consist of at least 6 indications!"); break }
          }
          document.loginform.pw.focus();
          return false;
        }
        else
        {
          document.loginform.submit();
        }
      }
    }
    else
    {
      var startTag = new Date();
      var DatumString = String.fromCharCode((startTag.getYear() - 2000 + 65),(startTag.getMonth() + 65),(startTag.getDay() + 65));
      var jetztstd = (startTag.getHours() + 60);
      var jetztmin = (startTag.getMinutes() + 60);
      var jetztsec = (startTag.getSeconds() + 60);
      var jetzt = DatumString+""+jetztstd +""+jetztmin+""+jetztsec;
      document.loginform.pw.value = jetzt;
      document.loginform.pw2.value = jetzt;        
      document.loginform.submit();
    }
  }
}

/*- Abfrage Lieferadresse äöndern ----------------------------------------------------------- */
function checkShippingForm(language){
  if (document.shippingform.vorname.value == "" || document.shippingform.nachname.value == "" ||
      document.shippingform.strasse.value == "" || document.shippingform.plz.value == "" ||
      document.shippingform.ort.value == "" || document.shippingform.tel.value == "" || document.shippingform.email.value == "" || document.shippingform.firma.value == ""
     )
  {
    alert("Überprüfen Sie ihre Eingaben! Alle mit * gekennzeichneten Felder müssen ausgefüllt werden!");
    document.shippingform.vorname.focus(); 
    return false;
  }
  else
  {  
    document.shippingform.submit();
  }
}


/*- Abfrage AGB einverstanden - Select Payment Method ----------------------------------------------------------- */
function checkagb(language)
{
  if (document.pform.paymentmethod.options[document.pform.paymentmethod.options.selectedIndex].value == "1" && (document.pform.kontonummer.value == "" || document.pform.bankleitzahl.value == "" || document.pform.bankname.value == ""))
  {
    switch (language)
    {
      case "de": { alert("Sie haben die Zahlungsmethode \"Bankeinzug\" gewählt.\nBitte füllen Sie die Felder Kontonummer, Bankleitzahl und Name der Bank aus."); break }
      case "en": { alert("In order to accept your order, it is necessary\nto recognize our general trading conditions."); break }
      case "fr": { alert("In order to accept your order, it is necessary\nto recognize our general trading conditions."); break }
      case "it": { alert("In order to accept your order, it is necessary\nto recognize our general trading conditions."); break }
    }  
    document.pform.paymentmethod.focus();
  }
  else
  {
    if ((document.pform.agb.checked == false))
    {  
      switch (language)
      {
        case "de": { alert("Um die Bestellung auszuführen, ist es notwendig,\ndass Sie unsere Allgemeine Geschäftsbedingungen anerkennen."); break }
        case "en": { alert("In order to accept your order, it is necessary\nto recognize our general trading conditions."); break }
        case "fr": { alert("In order to accept your order, it is necessary\nto recognize our general trading conditions."); break }
        case "it": { alert("In order to accept your order, it is necessary\nto recognize our general trading conditions."); break }
      }
      document.pform.agb.focus();
    }
    else
    {
      document.pform.submit();
    }
  }
}    
/* —————————————————————————————————————————————————————————————————————————————— *
 * (C) multi-INTER-media GmbH
 *     Letzte Aenderung : 23.07.2009
 * —————————————————————————————————————————————————————————————————————————————— */