//functies bij het laden van de pagina
$(function() {
	//Top images effect
	$("#head img")
		.fadeTo(3000, 0.5, effectPossible)
		.mouseover(function() {
			if(possible) {
				$(this).fadeTo("slow",1);
			}			
		})
		.mouseout(function() {
			if(possible) {
				$(this).fadeTo("slow",0.5);
			}
		});
	
	//zelfde effect voor relatiegeschenken maar zonder wachten:
	//en lightbox toepassen
	$(".geschenk")
		.fadeTo(0, 0.5)
		.mouseover(function() {
			$(this).fadeTo("slow",1);		
		})
		.mouseout(function() {
			$(this).fadeTo("slow",0.5);
		}).parent().lightBox({
			imageLoading: 'Plugins/lightbox/images/lightbox-ico-loading.gif',
			imageBtnClose: 'Plugins/lightbox/images/close.gif',
			imageBtnPrev: 'Plugins/lightbox/images/prev.gif',
			imageBtnNext: 'Plugins/lightbox/images/next.gif',
			imageBlank: 'Plugins/lightbox/images/lightbox-blank.gif',
			txtImage: 'Afbeelding',
			txtOf: 'van'
	   });
	
	//content effect:
	$("#content")
		.css("display", "none")
		.slideDown(1500);
	
	//logo effect toepassen:
	$("#logo img")
		.fadeTo(2000,0.5, beatingLogo)
		
	//contactformulier controleren:
	$("#contactform")
		.validate({
			errorContainer: $("#contacterror"), 
			rules: {
				naam: "required",
				voornaam: "required",
				email: {
						required: true,
						email: true
				},
				adres: "required",
				postcode: "required",
				tel: "required",
				bestelling: "required"
				
			},
			messages: {
					naam: "<span style='color:#CC0000;font-weight:bold'>*</span>",
					voornaam: "<span style='color:#CC0000;font-weight:bold'>*</span>",
					email: "<span style='color:#CC0000;font-weight:bold'>*</span>",
					adres: "<span style='color:#CC0000;font-weight:bold'>*</span>",
					postcode: "<span style='color:#CC0000;font-weight:bold'>*</span>",
					tel: "<span style='color:#CC0000;font-weight:bold'>*</span>",
					bestelling: "<span style='color:#CC0000;font-weight:bold'>*</span>"
			}				  
				  
		});
});


//muiseffecten bij bovenste afbeeldingen
var possible = false;
function effectPossible() {
	possible = true;
}

//kloppend logo
var beatingUp = true;
function beatingLogo() { 
	var alpha = (beatingUp) ? 0.9 : 0.5;
	beatingUp = !beatingUp;
	$(this).fadeTo(2000, alpha, beatingLogo);
}


