/* Rewrite Search */
function rewriteSearch(){
	var value = document.searchform.search.value;
		value = value.replace(/[^a-zA-Z 0-9]+/g,'');
		value = value.replace(/\s+/g, '-');
	
	var url = "archief-"+value+".html";
	window.location = url;
}
 
//Default Values
function defValue(fieldID,value){
	$(fieldID).focusin(function(){
		$(this).removeClass('default');
		if($(this).val()==value) $(this).val('');
	});
	$(fieldID).focusout(function(){
		if($(this).val()=='' || $(this).val()==value){
			$(this).val(value);
			$(this).addClass('default');
		}else{
			$(this).removeClass('default');
		}
	});
	$(fieldID).focusout();
}

//Validate email
function isValidEmail(email) {
        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
        return !emailReg.test( email ) ? false : true;
    }

//Menu
$(function(){
	$('#menu ul li ul').each(function(){
		$this = $(this);
		var out = '';
		$(this).parent('li').hover(function(){
			$el = $(this);
			$el.addClass('hover');
			$this.stop(true, true).slideDown(200);
			clearTimeout(out);
		}, function(){
			out = setTimeout(function(){
				$this.stop(true, true).slideUp(200);
				$(this).removeClass('hover');
			},500);
		});
	});
});
