function createXMLHttpRequest() // Zorgt dat AJAX werkt met explorer of andere browsers
  {
    if(window.ActiveXObject)
      {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
       }
    else if(window.XMLHttpRequest)
      {
        xmlHttp = new XMLHttpRequest();
       }
   }
					
function handleStateChange_header_navigatie_ets() // controleert de dataoverdracht is dit ok, dan wordt de opdracht opgehaald
  {		
    if(xmlHttp.readyState == 4)
      {		
        if(xmlHttp.status == 200)
          {		
		document.getElementById("navigatie_main").innerHTML=xmlHttp.responseText;

           }			
       }		
  }

function handleStateChange_header_navigatie_safes() // controleert de dataoverdracht is dit ok, dan wordt de opdracht opgehaald
  {		
    if(xmlHttp.readyState == 4)
      {		
        if(xmlHttp.status == 200)
          {		
		document.getElementById("navigatie_main").innerHTML=xmlHttp.responseText;
           }			
       }		
  }

function handleStateChange_snelzoeken_producttype() // controleert de dataoverdracht is dit ok, dan wordt de opdracht opgehaald
  {		
    if(xmlHttp.readyState == 4)
      {		
        if(xmlHttp.status == 200)
          {		
		document.getElementById("snelzoeken_producttype").innerHTML=xmlHttp.responseText;
           }			
       }		
  }


function header_navigatie(a)  {

  if (a == 'ets') {

  document.getElementById("tab_ets").className = "header_2_active";
  document.getElementById("tab_safes").className = "header_2_normal";
  document.getElementById("main_container").focus();

            var url_to_open = "/include/header_navigatie.php";
            url_to_open = url_to_open + '?ID=002';

            createXMLHttpRequest();
            xmlHttp.open("POST", url_to_open, true);
            xmlHttp.onreadystatechange = handleStateChange_header_navigatie_ets;
            xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
            xmlHttp.send(null);
  }

  else if (a == 'safes')  {

  document.getElementById("tab_safes").className = "header_2_active";
  document.getElementById("tab_ets").className = "header_2_normal";
  document.getElementById("main_container").focus();

            var url_to_open = "/include/header_navigatie.php";
            url_to_open = url_to_open + '?ID=001';

            createXMLHttpRequest();
            xmlHttp.open("POST", url_to_open, true);
            xmlHttp.onreadystatechange = handleStateChange_header_navigatie_safes;
            xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
            xmlHttp.send(null);
  }

  else  {
  alert ('Geen waarde');
  }
  }

function aanmakenProducttype()  {

     var productgroep = document.getElementById("snelzoeken_productgroep").value;

            var url_to_open = "/include/snelzoeken_producttype.php";
            url_to_open = url_to_open + '?productgroep=' +productgroep;

            createXMLHttpRequest();
            xmlHttp.open("POST", url_to_open, true);
            xmlHttp.onreadystatechange = handleStateChange_snelzoeken_producttype;
            xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
            xmlHttp.send(null);
     }

function snelZoeken()  {

     var producttype = document.getElementById("producttype").value;

     if (producttype == "")  {

          document.getElementById("snelzoeken_productgroep").className = "zoeken_body_fout";
          }

     else if (producttype == "leeg")  {

          document.getElementById("snelzoeken_productgroep").className = "zoeken_body_fout";
          }

     else  {

          window.open('http://www.remmers-safes.nl/detail.php?ID=' +producttype, '_self' );
          }
          }

function toonProduct(a)  {

      if (a == 'actief') {

    document.getElementById("products_inner").style.display = "none";
    document.getElementById("products_titel").style.display = "none";
    document.getElementById("products_image").style.display = "none";
    document.getElementById("products_tekst").style.display = "none";
    document.getElementById("products_inner_hover").style.display = "block";
    document.getElementById("products_titel_hover").style.display = "block";
    document.getElementById("products_image_hover").style.display = "block";
    document.getElementById("products_tekst_hover").style.display = "block";
        }

      else if (a == 'normaal') {

    document.getElementById("products_inner").style.display = "block";
    document.getElementById("products_titel").style.display = "block";
    document.getElementById("products_image").style.display = "block";
    document.getElementById("products_tekst").style.display = "block";
    document.getElementById("products_titel_hover").style.display = "none";
    document.getElementById("products_image_hover").style.display = "none";
    document.getElementById("products_tekst_hover").style.display = "none";
    document.getElementById("products_inner_hover").style.display = "none";
        }

        else {

        alert ("Anders");
        }
    }

function toonProductdetail(a,b)  {


      if (a == 'actief') {

      document.getElementById('detail_producten_' + b).style.display = "none";
      document.getElementById('detail_producten_' + b + '_hover').style.display = "block";
      }

      else if (a == 'normaal') {

      document.getElementById('detail_producten_' + b).style.display = "block";
      document.getElementById('detail_producten_' + b + '_hover').style.display = "none";
      }

      else {

      alert ('Hallo');
      }
      }

function doClear(theText) {

     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
 }


function handleStateChange_sendBelmij()  {		

      if(xmlHttp.readyState == 4)  {		

            if(xmlHttp.status == 200)  {			

            document.getElementById("vraag_inner").style.display = "none";
            document.getElementById("vraag_inner_ok").style.display = "block";
            document.getElementById("vraag_inner_ok").innerHTML=xmlHttp.responseText;
            }
            }
            }
					
function sendBelmij()  {		

      var nummer = document.getElementById("belterug_nummer").value;
      var vraag = document.getElementById("belterug_vraag").value;

      if (nummer.length < 10 || nummer == '' || nummer == 'Telefoonnummer' || nummer == 'Geen telefoonnummer') {

           document.getElementById("belterug_nummer").className = "belterug_nummer_fout";
           document.getElementById("belterug_nummer").value = "Telefoonnummer";
           }

           else {

            var url_to_open = "/include/insertbelterug.php";
            url_to_open = url_to_open + '?nummer=' + nummer + '&vraag=' + vraag;

      createXMLHttpRequest();
      xmlHttp.open("POST", url_to_open, true);
      xmlHttp.onreadystatechange = handleStateChange_sendBelmij;
      xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
      xmlHttp.send(null);
           }
           }

function handleStateChange_sendContactformulier()  {		

      if(xmlHttp.readyState == 4)  {		

            if(xmlHttp.status == 200)  {			

            document.getElementById("contactformulier").style.display = "none";
            document.getElementById("contactformulier_ok").style.display = "block";
            document.getElementById("contactformulier_ok").innerHTML=xmlHttp.responseText;
            }
            }
            }


function sendContactformulier()   {

      var bedrijfsnaam = document.getElementById("contact_bedrijfsnaam").value;
      var naam = document.getElementById("contact_naam").value;
      var telefoon = document.getElementById("contact_telefoon").value;
      var email = document.getElementById("contact_email").value;
      var vraag = document.getElementById("contact_vraag").value;

           if (naam == '' || naam == 'Uw naam')  {

           document.getElementById("contact_naam").className = "contactformulier_fout";
           document.getElementById("contact_naam").value = "Uw naam";
           }

           else if (telefoon.length < 10 || telefoon == '' || telefoon == 'Telefoonnummer')  {

           document.getElementById("contact_naam").className = "contactformulier";
           document.getElementById("contact_telefoon").className = "contactformulier_fout";
           document.getElementById("contact_telefoon").value = "Telefoonnummer";
           }

           else if (email == '' || email == 'E-mail')  {
           document.getElementById("contact_naam").className = "contactformulier";
           document.getElementById("contact_telefoon").className = "contactformulier";
           document.getElementById("contact_email").className = "contactformulier_fout";
           document.getElementById("contact_email").value = "E-mail";
           }

           else {

            var url_to_open = "/include/insertcontactformulier.php";
            url_to_open = url_to_open + '?naam=' + naam + '&telefoon=' + telefoon + '&email=' + email + '&bedrijfsnaam=' + bedrijfsnaam + '&vraag=' + vraag;

            createXMLHttpRequest();
            xmlHttp.open("POST", url_to_open, true);
            xmlHttp.onreadystatechange = handleStateChange_sendContactformulier;
            xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
            xmlHttp.send(null);
            }

           }