/* —————————————————————————————————————————————————————————————————————————————— *
 *  tools.js 
 * —————————————————————————————————————————————————————————————————————————————— */
  function AddToFavorites(url,title) 
  { 
    if (window.sidebar) // Mozilla Firefox
    { 
      window.sidebar.addPanel(title, url,"");	
    } 
    else if(window.external)  // IE, Safari		
    { 
      window.external.AddFavorite( url, title); 
    }	
    else if(window.opera && window.print) // Opera Hotlist		
    { 
      var elem = document.createElement('a');
      elem.setAttribute('href',url);
      elem.setAttribute('title',title);
      elem.setAttribute('rel','sidebar');
      elem.click();
    } 
  }
/* —————————————————————————————————————————————————————————————————————————————— */
   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 checkForm() 
  {
    if ((document.kontform.name.value == "")||(document.kontform.email.value == ""))
    {
      alert("Bitte geben Sie Ihren Namen und Ihre E-Mail-Adresse an.");
      return false;
    }
    else
    {
      var rx = /^([^\s@,:"<>]+)@([^\s@,:"<>]+\.[^\s@,:"<>.\d]{2,}|(\d{1,3}\.){3}\d{1,3})$/;
      var part = document.kontform.email.value.match(rx);
      if(part)
      {
      }
      else 
      { 
        alert("Bitte geben Sie eine E-Mail-Adresse an.");
        return false; 
      }
    }
    return true;
  }
/* ------------------------------------------------------------------------------ */
  function statusText(text)
  {
    name1=text;
    setTimeout("window.status=name1;",0.1);
    return true;
  }
/* ------------------------------------------------------------------------------ */
  function hoverIE() 
  {
    var LI = document.getElementById("mnav").firstChild.firstChild;
    do
    {
      if (sucheUL(LI.firstChild)) 
      {           
        if (LI.className.indexOf("selected") == -1)
        {
          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);
    
    if (navigator.userAgent.indexOf("MSIE 6") != -1)
    {      
      if(window.navigator.systemLanguage && !window.navigator.language) 
      {
        UL.style.visibility = "visible";
      }
    }
    
    //---------------------------------------
    var windowHeight = getWindowWize();
    var topUL = getTop(UL);
    if(topUL+UL.offsetHeight > windowHeight) {
      UL.style.top = -1*(UL.offsetHeight-(windowHeight-topUL)) + 'px';
    }
    //---------------------------------------
    
    if (navigator.userAgent.indexOf("MSIE 6") != -1)
    {      
      if(window.navigator.systemLanguage && !window.navigator.language) 
      {
        var hoehe = UL.offsetHeight;
        
        if(hoehe < 0)
          hoehe = 0
          
        if(this.childNodes[1] != null)
        {
          this.childNodes[1].style.display = "block";
          this.childNodes[1].style.height = hoehe + "px";
          this.style.zIndex = "999";
          
          
          if(topUL+UL.offsetHeight > windowHeight) {
            this.childNodes[1].style.top = -1*(UL.offsetHeight-(windowHeight-topUL)) + 'px';
          }
        }
      }
    }
  }
/* ------------------------------------------------------------------------------ */
  function ausblenden() 
  {
    if (navigator.userAgent.indexOf("MSIE 6") != -1)
    {      
      if(window.navigator.systemLanguage && !window.navigator.language) 
      {
        sucheUL(this.firstChild).style.visibility = "hidden";
        this.style.zIndex = "998";
      }
    }
  }
/* ------------------------------------------------------------------------------ */
  function getTop(Element){
    var Parent = Element;
    var layerTop = 0;
    while (Parent) {
      layerTop = layerTop + Parent.offsetTop;
      Parent = Parent.offsetParent;
    }
    var scrollY = 0;
    if (typeof( window.innerHeight ) == 'number') { //Non-IE
      scrollY = window.pageYOffset;
    }
    else if (document.documentElement && (document.documentElement.clientHeight)) { //IE 6+ in 'standards compliant mode'
      scrollY = document.documentElement.scrollTop;
    }
    else if (document.body && (document.body.clientHeight)) { //IE 4 compatible
      scrollY = document.body.scrollTop;
    }
    return layerTop-scrollY;
  }
/* ------------------------------------------------------------------------------ */
  // Höhe des Anzeigebereichs ermitteln
  function getWindowWize() {
   var myHeight = 0;
   if (typeof( window.innerHeight ) == 'number') { //Non-IE
    myHeight = window.innerHeight;
   }
   else if (document.documentElement && (document.documentElement.clientHeight)) { //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
   }
   else if (document.body && (document.body.clientHeight)) { //IE 4 compatible
    myHeight = document.body.clientHeight;
   }
   return myHeight;
  }


/*- 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();
    }
  }
}


/* —————————————————————————————————————————————————————————————————————————————— *
 *  searchhi.js 
 *  -----------
 *  http://www.kryogenix.org/code/browser/searchhi/
 *
 *  Modified 17.01.2008 by multi-INTER-media GmbH
 * ------------------------------------------------------------------------------
 * <span class="nosearchhi"> ... TEXT ... </span>      ->   is still working
 *
 * .searchword0 {color: #222; background-color: #ff0; border: 1px dotted #ff0;}
 * ...
 * .searchword5 = CSS-Style with different colors for differnt searchterms
 * —————————————————————————————————————————————————————————————————————————————— */

  function highlightWord(node,word,wordnr) 
  {
    if (node.hasChildNodes) 
    {
      var hi_cn;
      for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) 
      {
        highlightWord(node.childNodes[hi_cn],word,wordnr);
      }
    }
    if (node.nodeType == 3) 
    { 
      tempNodeVal = node.nodeValue.toLowerCase();
      tempWordVal = word.toLowerCase();
      if (tempNodeVal.indexOf(tempWordVal) != -1) 
      {
        pn = node.parentNode;
        klasse = "searchword"+wordnr;
        checkn = pn;
        while (checkn.nodeType != 9 && 
        checkn.nodeName.toLowerCase() != 'body') 
        { 
          if ((checkn.className.match(/\bnosearchhi\b/)) || (checkn.className.match(/\bhornav\b/))) 
          { 
            return; 
          }
          checkn = checkn.parentNode;
        }
        if (pn.className != klasse) 
        {
          nv = node.nodeValue;
          ni = tempNodeVal.indexOf(tempWordVal);
          before = document.createTextNode(nv.substr(0,ni));
          docWordVal = nv.substr(ni,word.length);
          after = document.createTextNode(nv.substr(ni+word.length));
          hiwordtext = document.createTextNode(docWordVal);
          hiword = document.createElement("span");
          hiword.className = klasse;
          hiword.appendChild(hiwordtext);
          pn.insertBefore(before,node);
          pn.insertBefore(hiword,node);
          pn.insertBefore(after,node);
          pn.removeChild(node);
        }
      }
    }
  }
/* —————————————————————————————————————————————————————————————————————————————— */
  function SearchHighlight(qs) 
  {
    if (!document.createElement) return;
    if (qs.length < 3) return;
    words = unescape(qs.replace(/\+/g,' ')).split(/\s+/);
    for (w=0;w<words.length;w++) 
    {
       highlightWord(document.getElementById("suchergebnisbereich"),words[w],w);
    }
  }
/* —————————————————————————————————————————————————————————————————————————————— *
 * (C) multi-INTER-media GmbH
 *     Letzte Aenderung : 23.07.2009
 * —————————————————————————————————————————————————————————————————————————————— */
