this.label2value = function(){

	var inactive = "inactive";
	var active = "active";
	var focused = "focused";

	$("label").each(function(){
		obj = document.getElementById($(this).attr("for"));
		if(($(obj).attr("type") == "text") || (obj.tagName.toLowerCase() == "textarea")){
			$(obj).addClass(inactive);
			var text = $(this).text();
			$(this).css("display","none");
			$(obj).val(text);
			$(obj).focus(function(){
				$(this).addClass(focused);
				$(this).removeClass(inactive);
				$(this).removeClass(active);
				if($(this).val() == text) $(this).val("");
			});
			$(obj).blur(function(){
				$(this).removeClass(focused);
				if($(this).val() == "") {
					$(this).val(text);
					$(this).addClass(inactive);
				} else {
					$(this).addClass(active);
				};
			});
		};
	});
};
$(document).ready(function(){
	label2value();
});

	$(document).ready(function() {
		$("#aanmeldknop").hide();
		$("#emailadres").keyup(function(){
			var email = $("#emailadres").val();
			
			if(email != 0)
			{
				if(isValidEmailAddress(email))
				{
					$("#aanmeldknop").show();
					$("#validEmail").css({
						"background-image": "url('images/validYes.png')"
					});
				} else {
					$("#aanmeldknop").hide();
					$("#validEmail").css({
						"background-image": "url('images/validNo.png')"
					});
				}
			} else {
				$("#aanmeldknop").hide();
				$("#validEmail").css({
					"background-image": "none"
				});
			}

		});

	});

function isValidEmailAddress(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}

