	/*checks if the given radio button is checked*/
	function validateRadio(fieldName, wrap){
		if ($(wrap).html() == null) wrap = $(document);
		var var_name = $("input[name=" + fieldName + "]:checked", wrap).val();
		if(var_name){
			return true;
		}else{
			return false;
		}
	}
	/*checks of a field is filled*/
	/* this trim doesn't work correctly function validateText(fieldName, wrap){
		if ($(wrap).html() == null) wrap = $(document);
		if($("input[name=" + fieldName + "]", wrap).val().trim().length == 0 ){
			return false;
		}else{
			return true;
		}
	} */
	function validateText(fieldName, wrap){
		if ($(wrap).html() == null) wrap = $(document);
		if($.trim($("input[name=" + fieldName + "]", wrap).val()).length == 0 ){
			return false;
		}else{
			return true;
		}
	}
	/*checks of a textarea is filled*/
	function validateTextField(fieldName, wrap){
		if ($(wrap).html() == null) wrap = $(document);
		if($("textarea[name=" + fieldName + "]", wrap).val().length > 4 ){
			return true;
		}else{
			return false;
		}
	}
	/*checks of a field is filled with a postcode*/
	function validatePostcode(fieldName, wrap){
		if ($(wrap).html() == null) wrap = $(document);
		//if($("input[name=" + fieldName + "]", wrap).val().replace(" ","").length != 6){
		if($("input[name=" + fieldName + "]", wrap).val().replace(" ","").length == 0){
			return false;
		}else{
			return true;
		}
	}
	/*checks if a date if confirm a specific dateformat: dd-mm-yyyy.*/
	function validateDatum(fieldName, wrap) {
	    if ($(wrap).html() == null) wrap = $(document);
	    var mo, day, yr;
	    var entry = $("input[name=" + fieldName + "]", wrap).val().replace(" ","");
	    var re = /\b\d{1,2}[-]\d{1,2}[-]\d{4}\b/;
	    if (re.test(entry)) {
	        var delimChar = (entry.indexOf("/") != -1) ? "/" : "-";
	        var delim1 = entry.indexOf(delimChar);
	        var delim2 = entry.lastIndexOf(delimChar);
	        day = parseInt(entry.substring(0, delim1), 10);
	        mo = parseInt(entry.substring(delim1+1, delim2), 10);
	        yr = parseInt(entry.substring(delim2+1), 10);
	        var testDate = new Date(yr, mo-1, day);
	        if (testDate.getDate() == day) {
	            if (testDate.getMonth() + 1 == mo) {
	                if (testDate.getFullYear() == yr) {
	                    return true;
	                } else {
	                    //alert("There is a problem with the year entry.");
						return false;
	                }
	            } else {
	                //alert("There is a problem with the month entry.");
					return false;
	            }
	        } else {
	            //alert("There is a problem with the date entry.");
				return false;
	        }
	    } else {
	        //alert("Incorrect date format. Enter as mm/dd/yyyy.");
			return false;
	    }
	    return false;
	}
	/*checks if a date if confirm a specific dateformat: dd-mm-yyyy.*/
	function validateDatumEN(fieldName, wrap) {
	    if ($(wrap).html() == null) wrap = $(document);
	    var mo, day, yr;
	    var entry = $("input[name=" + fieldName + "]", wrap).val().replace(" ","");
	    var re = /\b\d{1,2}[-]\d{1,2}[-]\d{4}\b/;
	    if (re.test(entry)) {
	        var delimChar = (entry.indexOf("/") != -1) ? "/" : "-";
	        var delim1 = entry.indexOf(delimChar);
	        var delim2 = entry.lastIndexOf(delimChar);
	        mo = parseInt(entry.substring(0, delim1), 10);
	        day = parseInt(entry.substring(delim1+1, delim2), 10);
	        yr = parseInt(entry.substring(delim2+1), 10);
	        var testDate = new Date(yr, mo-1, day);
	        if (testDate.getDate() == day) {
	            if (testDate.getMonth() + 1 == mo) {
	                if (testDate.getFullYear() == yr) {
	                    return true;
	                } else {
	                    //alert("There is a problem with the year entry.");
						return false;
	                }
	            } else {
	                //alert("There is a problem with the month entry.");
					return false;
	            }
	        } else {
	            //alert("There is a problem with the date entry.");
				return false;
	        }
	    } else {
	        //alert("Incorrect date format. Enter as mm/dd/yyyy.");
			return false;
	    }
	    return false;
	}
	/*checks if a field is filled with a dutch telephonenumber*/
	function validateDutchPhonenumber(fieldName, wrap){
                                if ($(wrap).html() == null) wrap = $(document);
		if($("input[name=" + fieldName + "]", wrap).val().replace(" ","").replace("-","").length != 10){
			return false;
		}else{
			var number;
			number = $("input[name=" + fieldName + "]", wrap).val().replace(" ","").replace("-","");
			if(number.length == 10){
				return true;
			}else{
				return false;
			}
		}
	}
	/*checks if a field is filled with a good formed email address*/
	function validateEmailAddress(fieldName, wrap){
                                if ($(wrap).html() == null) wrap = $(document);
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  		var address = $("input[name=" + fieldName + "]", wrap).val();
  		if(reg.test(address) == false) {
     		return false;
  		}else{
			return true;
		}
	}
	/*checks a checkbox if it is selected*/
	function validateCheckbox(fieldName, wrap){
		if ($(wrap).html() == null) wrap = $(document);
		if($("input[name=" + fieldName + "]:checked", wrap).size() == 0){
			return false;
		}else{
			return true;
		}
	}
	/*checks if a field is filled with a number*/
	function validateNumber(fieldName, wrap){
                                if ($(wrap).html() == null) wrap = $(document);
		var reg = /^([0-9.]{1,10})$/;
  		var number = $("input[name=" + fieldName + "]", wrap).val();
  		if(reg.test(number) == false) {
     		return false;
  		}else{
			return true;
		}
	}

