function checkForm(sForm, sFields){
	var aFields;
	var bResult=true;
	var oFrm;
	oFrm = document.forms[sForm];
	aFields = sFields.split(",");
	for(i=0; i<aFields.length; i++){
		if(oFrm.elements[aFields[i]]){
			if(aFields[i]=='email'){
				if(!checkEmail(oFrm.elements[aFields[i]].value)){ 
					alert('You didn\'t fill in a valid email address!');
					oFrm.elements[aFields[i]].focus();
					bResult=false;
					break;
				}
			}
			if(oFrm.elements[aFields[i]].value + ''==''){ 
				alert('You forgot to fill in your ' +aFields[i]);
				oFrm.elements[aFields[i]].focus();
				bResult=false;
				break;
			}
		}
	}
	return bResult;
}


function checkEmail(checkString){
    var newstr = "";
    var at = false;
    var dot = false;

    // Als email een '@' heeft
    if (checkString.indexOf("@") != -1) {
      at = true;

    // Als email een '.' heeft
    } else if (checkString.indexOf(".") != -1) {
      dot = true;
    }

    // Onthouden van de string
    for (var i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                newstr += ch;
                if (ch == "@") {
                    at=true;
                }
                if (ch == ".") {
                    dot=true;
                }
        }
    }
    if ((at == true) && (dot == true)) {
        return true;
    }
    else {
      return false;
    }
}

