
$(document).ready(function(){
   $("div.gallerij_foto a").fancybox();
    
   var iHoogte = ($(window).height()) - 30;
   $("#container").attr("style", "min-height:" + iHoogte + "px; height:auto !important; height:" + iHoogte + "px;");
});  

/**
 * Focus en blur van de contactvelden
 */ 
function BlurVeld(sInhoud, sVeldid) {
   if($("#" + sVeldid).val()=="") {
      $("#" + sVeldid).val(sInhoud);
   }
} 

function FocusVeld(sInhoud, sVeldid) {
   if($("#" + sVeldid).val()==sInhoud) {
      $("#" + sVeldid).val("");
   }
}

/**
 * Reset het formulier en geef de velden de juiste waarden
 * afhankelijk van de taal
 * 
 * @param   p_sNaam     Naam
 * @param   p_sEmail    Email
 * @param   p_sBericht  Bericht       
 */ 
function ResetFormulier() {
   $("input#naam").val("Uw naam");
   $("input#email").val("Uw e-mail");
   $("textarea#bericht").val("Bericht");
}

/**
 * Verstuurt het contactformulier bericht.
 */ 
function VerstuurBericht() {
   var sNaam = $("input#naam").val();
   var sEmail = $("input#email").val();
   var sBericht = $("textarea#bericht").val();
   
   if(!sNaam || sNaam == "Uw naam" || !sEmail || sEmail == "Uw e-mail" || !sBericht || sBericht == "Bericht") {
      alert('Uw heeft niet alle velden ingevuld.')
   } else {   
      $.post("/ajax/Contact/", {naam: sNaam, email: sEmail, bericht: sBericht}, function(sAntwoord) {
         if(sAntwoord=="") {
            $("input#naam").val("Uw naam");
            $("input#email").val("Uw e-mail");
            $("textarea#bericht").val("Bericht");
            alert('Uw bericht is verstuurd en zal zo snel mogelijk beantwoord worden.');
         } else {
            alert('Technical issue: ' + sAntwoord);
         }
      });
   }        
}

/**
 * Veranderd de taal van de website
 * 
 * @param   p_iTaalid      Nieuwe taal  
 */ 
function VeranderTaal(p_iTaalid) {
   $.post("/ajax/VeranderTaal/", {taalid: p_iTaalid}, function(sAntwoord) {
      if(sAntwoord!="") {
         alert(sAntwoord);
      } else {
         window.location = ("/");
      }
   });
}

/**
 * Toont de extra tekst van de diensten
 * 
 * @param   p_iDienstid    Dienst id  
 */ 
function LeesMeer(p_iDienstid) {
   $("a#leesmeer_" + p_iDienstid).hide();
   $("div#lang_" + p_iDienstid).show("slow");
   $("p#tekst_" + p_iDienstid).show();
}

/**
 * Veranderd de foto van een bepaalde dienst
 * 
 * @param   p_iDienst   Dienst ID
 * @param   p_iFoto     Fotonummer   
 */ 
function VeranderFoto(p_iDienst, p_iFoto) {
   $("p#dienst" + p_iDienst + " img").attr("src", "/images/diensten/" + p_iDienst + "/" + p_iFoto + "_groot.jpg");
}

