function pageHandler() {
	
	$("a#reserveren").fancybox({
		'hideOnContentClick': false,
		'width' 			: 360,
		'height' 			: 440,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'autoScale' 		: false,
		'scrolling'			: 'no',
		'overlayColor'		: '#333',
		'opacity'			: true
	});
	
	$("a.kaart").fancybox({
		'hideOnContentClick': false,
		'width' 			: 900,
		'height' 			: 600,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'autoScale' 		: false,
		'overlayColor'		: '#333',
		'opacity'			: true
	});
	
	$.address.change(function(event) {
	  
		locatie = $.address.pathNames();
		var depth = locatie.length;
		if(depth == 0) {
			locatie[0] = "Welkom";
		}
		//locatie = $.address.path().substring(1);
			
		 //alert(locatie[0]+" - "+locatie[1]);
			
		$("#"+locatie[0]).prevAll(".out").animate({"left": "-=700px"}, 1000, 'easeOutExpo');
		$("#"+locatie[0]).prevAll(".out").removeClass("out").addClass("in");
		
		$("#"+locatie[0]+".out").animate({"left": "-=700px"}, 1000, 'easeOutExpo');
		$("#"+locatie[0]+".out").removeClass("out").addClass("in");
		
		$("#"+locatie[0]).nextAll(".in").animate({"left": "+=700px"}, 1000, 'easeOutExpo');
		$("#"+locatie[0]).nextAll(".in").removeClass("in").addClass("out");
		
		//$("#"+locatie[0]).children(".content").filter(":first").nextAll(".content").fadeOut("slow");
		//$("#"+locatie[0]).children(".content").nextAll(".content").fadeOut("slow");
	
		$(".content.hidden").fadeOut("slow");
		$(".hiddenImg").fadeOut("slow");
		
		$.address.title("Restaurant Cheval Blanc || "+locatie[0].replace(/_/g, " "));
		
		if(depth == 2) {
			$("#"+locatie[1]).fadeIn("slow");
			$("#img"+locatie[1]).fadeIn("slow");
			$.address.title("Restaurant Cheval Blanc || "+locatie[0].replace(/_/g, " ")+" » "+locatie[1].replace(/_/g, " "));
		}
		
		if(depth == 3) {
			$("#"+locatie[2]).fadeIn("slow");
			$.address.title("Restaurant Cheval Blanc || "+locatie[0].replace(/_/g, " ")+" » "+locatie[1].replace(/_/g, " ")+" » "+locatie[2].replace(/_/g, " "));
		}
				
		if(depth == 4) {
			$("#"+locatie[3]).fadeIn("slow");
			$.address.title("Restaurant Cheval Blanc || "+locatie[0].replace(/_/g, " ")+" » "+locatie[1].replace(/_/g, " ")+" » "+locatie[2].replace(/_/g, " ")+" » "+locatie[3].replace(/_/g, " "));
		}
	
	});
	
	$(".imgContainer").mouseenter(function(){
		$(".commentBG", this).animate({"margin-top": "-40"}, "fast");
	});
	
	$(".imgContainer").mouseleave(function(){
		$(".commentBG", this).animate({"margin-top": "0"}, "fast");
	});
		
}

<!--

/* This script is Copyright (c) Paul McFedries and 
Logophilia Limited (http://www.mcfedries.com/).
Permission is granted to use this script as long as 
this Copyright notice remains in place.*/

function CalculateTotal(frm) {
    var order_total = 0
	
    // Run through all the form fields
    for (var i=0; i < frm.elements.length; ++i) {

        // Get the current field
        form_field = frm.elements[i]

        // Get the field's name
        form_name = form_field.name
		
        // Is it a "product" field?
        if (form_name.substring(0,4) == "PROD") {

            // If so, extract the price from the name
            item_price = parseFloat(form_name.substring(form_name.lastIndexOf("_") + 1))
			item_code = form_name.substring(form_name.indexOf("_") + 1, form_name.lastIndexOf("_"))
			
            // Get the quantity
            item_quantity = parseInt(form_field.value)

            // Update the order total
            if (item_quantity >= 0) {
				for (var j=0; j < frm.elements.length; ++j) {
					form_field2 = frm.elements[j]
        			form_name2 = form_field2.name
					if (form_name2.substring(form_name2.lastIndexOf("_") + 1) == item_code) {
						frm.elements[j].value = round_decimals(item_quantity * item_price, 2)
					}
				}
				order_total += item_quantity * item_price
            }
        }
    }

    // Display the total rounded to two decimal places
    frm.TOTAL.value = round_decimals(order_total, 2)
}

function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "," : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}

//-->

function validateFormOnSubmit(theForm) {

  var reason = "";

  //reason += validateUsername(theForm.username);
  //reason += validatePassword(theForm.pwd);
  reason += validateEmpty(theForm.name);
  reason += validateEmail(theForm.email);
  reason += validatePhone(theForm.phone);
  reason += validateQuantity(theForm.amuse);
  reason += validateQuantity(theForm.voorgerecht);
  reason += validateQuantity(theForm.voorwijn);
  reason += validateQuantity(theForm.tussenkoud);
  reason += validateQuantity(theForm.tussenwarm);
  reason += validateQuantity(theForm.tussenkoudwijn);
  reason += validateQuantity(theForm.tussenwarmwijn);
  reason += validateQuantity(theForm.soep);
  reason += validateQuantity(theForm.hoofdgerecht);
  reason += validateQuantity(theForm.hoofdwijn1);
  reason += validateQuantity(theForm.hoofdwijn2);
  reason += validateQuantity(theForm.kaas);
  reason += validateQuantity(theForm.dessert);
  reason += validateQuantity(theForm.dessertwijn);
  
      
  if (reason != "") {
    alert("De volgende velden zijn niet juist ingevuld:\n" + reason);
    return false;
  }

  return true;
}

function validateEmpty(fld) {
    var error = "";
  
    if (fld.value.length == 0) {
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
        error = " - Er is geen naam ingevuld\n"
    } else {
        fld.style.background = '#333333';
		fld.style.color = '#FFFFFF'; 
    }
    return error;   
}

function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
} 

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
    
    if (fld.value == "") {
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
        error = " - Er is geen e-mail adres ingevuld\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
        error = " - Er is een ongeldig e-mail adres ingevuld\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
        error = " - Het ingevulde e-mail adres bevat symbolen die niet zijn toegestaan\n";
    } else {
        fld.style.background = '#333333';
		fld.style.color = '#FFFFFF'; 
    }
    return error;
}

function validatePhone(fld) {
    var error = "";
    var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');     

   if (fld.value == "") {
        error = " - Er is geen telefoonnummer ingevuld\n";
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
    } else if (isNaN(parseInt(stripped))) {
        error = " - Het ingevulde telefoonnummer bestaat niet alleen uit cijfers\n";
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
    } else if (!(stripped.length == 10)) {
        error = " - Het telefoonnummer bestaan niet uit 10 cijfers\n";
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
    } else {
        fld.style.background = '#333333';
		fld.style.color = '#FFFFFF';
    }
    return error;
}

function validateQuantity(fld) {
    var error = "";
    var stripped = fld.value//.replace(/[\(\)\.\-\ ]/g, '');     
   
   if (fld.value == "") {
        fld.value = "0";
    } else if (isNaN(parseInt(stripped))) {
        error = " - Het ingevulde aantal bestaat niet alleen uit cijfers\n";
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
    } else if (parseInt(stripped) > 40) {
        error = " - Het ingevulde aantal mag niet groter dan 40 zijn\n";
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
    } else if (parseInt(stripped) < 0) {
        error = " - Het ingevulde aantal mag niet kleiner dan 0 zijn\n";
        fld.style.background = '#FF9999';
		fld.style.color = '#000000'; 
    } else {
        fld.style.background = '#333333';
		fld.style.color = '#FFFFFF';
    }
    return error;
}
