
$(document).ready( function(){ setupZoom();


        var url = document.location.href;
          var startDeel = url.indexOf('index.php');
          if( url.indexOf('index.php') == -1)
            startDeel = url.indexOf('zakelijk.php');

          url = url.slice(startDeel);

          $('div#menu a').each(function(){

              if($(this).attr("href") == url){
                $(this).addClass("active");
              }
          });

       $('div.camera').jEye();

       $("div.menuLinks div.boven a").mouseover(function(){
            $("div.menuLinks div.boven a").removeClass("active");
            $(this).addClass('active');
            $('div.menuLinks div.onder div').hide();
            $('div#' + $(this).attr("name")).show();
             checkStippels();
       });

       // $("div.menuLinks div.onder div:first").show();

        // plaatsen van het pijltje!
          var url = document.location.href;
          var startDeel = url.indexOf('index.php');
          if( url.indexOf('index.php') == -1)
            startDeel = url.indexOf('zakelijk.php');
          url = url.slice(startDeel);

          $('div#menuItems a').each(function(){

              if($(this).attr("href") == url){
                 $(this).addClass("active");
                 $("div#menuItems div").hide();
                 $(this).parent("div").show();
                 welkeTab = $(this).parent("div").attr("id");

                 $('div.menuLinks div.boven a').each(function(){
                    if( $(this).attr("name") == welkeTab){
                        $("div.menuLinks div.boven a").removeClass("active");
                        $(this).addClass('active');
                    }
                 });
              }
          });

           if($(document).height() < $(window).height()){   //fix voor sanders gepiep over de footer
                var grootteVerschil = $(window).height() - $(document).height();
                alert(grootteVerschil);
                $('div.inhoud').height(  $('div.inhoud').height() +  grootteVerschil);
            }

          if( $('div.productTab').length > 0){

                if( $('div.inhoud').height() < 466){
                  $('div.productTab').css('top', 466 - $('div.inhoud').height());
                }

               var linkTekst = $('div.productLinks span:first').text();
               var link2Tekst = $('div.productLinks span:first').attr("name");
               $('a#prodLink').attr('href', 'inhoud/producten/' + linkTekst + '.pdf');
               $('img#pdfImg').attr('src', 'inhoud/producten/pdfImg_' + linkTekst + '.jpg');
               $('a#prodLinkTwee').attr('href', 'inhoud/producten/' + linkTekst + '.pdf');

               $('a#handLink').attr('href', 'inhoud/producten/' + link2Tekst + '.pdf');
               $('img#handImg').attr('src', 'inhoud/producten/handImg_' + link2Tekst + '.jpg');
               $('a#handLinkTwee').attr('href', 'inhoud/producten/' + link2Tekst + '.pdf');

               $('div.productLinks span').click(function(){
                  linkTekst = $(this).text();
                  link2Tekst = $(this).attr("name");
                  $('a#prodLink').attr('href', 'inhoud/producten/' + linkTekst + '.pdf');
                  $('img#pdfImg').attr('src', 'inhoud/producten/pdfImg_' + linkTekst + '.jpg');
                  $('a#prodLinkTwee').attr('href', 'inhoud/producten/' + linkTekst + '.pdf');

                  $('a#handLink').attr('href', 'inhoud/producten/' + link2Tekst + '.pdf');
                  $('img#handImg').attr('src', 'inhoud/producten/handImg_' + link2Tekst + '.jpg');
                  $('a#handLinkTwee').attr('href', 'inhoud/producten/' + link2Tekst + '.pdf');
               });
          }

        lichtBulletsOp();

        checkStippels();



    });

function nowInterval( fn, time ) {
    fn();
    return setInterval( fn, time );
}


function lichtBulletsOp(){
    $('.fade').innerfade({
	    speed: 1000,
	    timeout: 6000,
	    type: 'random_start',
	    containerheight: '25px'
	});

}

function checkStippels(){


      $("div.menuLinks div.boven a.active").each(function(){
            $("div.menuLinks div.boven a").attr("style", "");
          $("img.sep").show();
           if( $(this).attr("name") == "producten"){
              $(this).next("img.sep").hide();
              $(this).css("padding","13px 20px 9px 35px");
           }
           if( $(this).attr("name") == "diensten"){
              $("div.menuLinks div.boven img.sep").hide();
              $(this).css("padding","13px 20px 9px 21px");
              $(this).css("margin-right","6px");
           }
           if( $(this).attr("name") == "handleidingen"){
              $(this).prev("img.sep").hide();
              $(this).css("padding","13px 20px 9px 20px");
           }

       });

}



function showToolTip(msg,evt, element){
      if (evt) {
          var url = evt.target;
      }
      else {
          evt = window.event;
          var url = evt.srcElement;
      }
      //xPos = $(element).position().left;
      //yPos = $(element).position().top - 69;

      //xPos = evt.clientX + 10;
     // yPos = evt.clientY;


      //if(xPos > 340){
       // xPos -= 343;
     // }

     var toolTip = document.getElementById("toolTip");
     toolTip.innerHTML = "<p>"+msg+"</p>";



     //toolTip.style.top = parseInt(yPos) + "px";
     //toolTip.style.left = parseInt(xPos) + "px";
     toolTip.style.visibility = "visible";

   }

  function hideToolTip(){
     var toolTip = document.getElementById("toolTip");
     toolTip.style.visibility = "hidden";
  }

function RequiredNames1()
    {

    naam = document.form1.naam.value;
    voorletters = document.form1.voorletters.value;
	geslacht = document.form1.geslacht.value;
	adres = document.form1.adres.value;
    postcode = document.form1.postcode.value;
    woonplaats = document.form1.woonplaats.value;
    telefoon = document.form1.telefoon.value;
    emailadres = document.form1.emailadres.value;
    vraag = document.form1.vraag.value;
    laatste = document.form1.laatste.value;

	if (naam == '')
		{
		alert("U bent vergeten uw naam in te vullen.");
		return false;
        }
    if (voorletters == '')
		{
		alert("U bent vergeten uw voorletters in te vullen.");
		return false;
        }
    if (geslacht == '')
		{
		alert("U bent vergeten een geslacht te selecteren.");
		return false;
        }
    if (adres == '')
		{
		alert("U bent vergeten uw adresgegevens in te vullen.");
		return false;
		}
   if (postcode == '')
		{
		alert("U bent vergeten uw postcode in te vullen.");
		return false;
		}
   if (woonplaats == '')
		{
		alert("U bent vergeten uw woonplaats in te vullen.");
		return false;
		}
   if (telefoon == '')
		{
		alert("U bent vergeten uw telefoonnumer in te vullen.");
		return false;
		}
   if (emailadres == '')
		{
		alert("U bent vergeten uw emailadres in te vullen.");
		return false;
		}
   if (vraag == '')
		{
		alert("U bent vergeten uw vraag in te vullen.");
		return false;
		}
   if (laatste != '')
		{
		return false;
		}
   document.forms.form1.submit();
}
