function checkContactForm()
{
	var flag=true;
	$("#contactform .required").each(function(){
		$(this).removeClass("error");
		if($(this).val()=="")
		{
			$(this).addClass("error");
			flag=false;
		}
	});
	if (flag==true)
	{ 
		$("#message").html('');
		return true; 
	} 
	else 
	{
		$("#message").html('Niet alle benodigde velden zijn ingevuld!');
		return false;
	}
}

function addWebshopToForm()
{
	var cnt = $("div.hidden").size();
	if (cnt==1)
	{
		$("span#addWebshop").slideUp();
	}
	var t = $("div#webshop"+(6-cnt));
	t.slideDown();
	t.removeClass("hidden");
}

$(document).ready(function(){

	$('a[rel=imgzoom]').fancybox(
	{
		'titleShow': false,
		'hideOnContentClick': true,
		'overlayOpacity': 0.7,
		'cyclic': true
	});

	$('a[rel=fancybox]').fancybox(
	{
		'titleShow': false,
		'hideOnContentClick': false,
		'overlayOpacity': 0.7,
		'showNavArrows': false
	});

	$("a[id='youtube']").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'			: 640,
				'height'		: 387,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					 'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
		return false;
	});

	$('#resendpassword').submit(function(){
		var pwdemail = $('#resendpassword input[name=pwdemail]').val();
		$.post('../scripts/resendpassword.php', {email: pwdemail}, function(data) {
			if (data == "ok")
			{
				$('#wachtwoordvergeten p[id=message]').html("Het wachtwoord is per e-mail toegezonden.");

			}
			else if (data == "error")
			{
				$('#wachtwoordvergeten p[id=message]').html("Het opgegeven e-mailadres is niet bekend, probeer het opnieuw.");
			}
			else
			{
				$('#wachtwoordvergeten p[id=message]').html("Er is een fout opgetreden, neemt u a.u.b. contact met ons op.");
			}

		});
		return false;
	});

});
