function ValidateForm() {
	var bolSubmitForm = true;
	$(".Req").each(function(){
		ErrorType = "";
		if($(this).hasClass("Text")){
			if(this.value.match(/[A-Za-z0-9]/gi)==null){
				ErrorType = "Text";
			}
		}
		if($(this).hasClass("Text2Jay")){
			if($('#boxEmail').attr('checked') && this.value.match(/[A-Za-z0-9]/gi)==null){
				ErrorType = "Text";
			}
		}
		if($(this).hasClass("Email")) {
			if(this.value.match(/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/gi)==null){
				ErrorType = "Email";
			}
		}
		if($(this).hasClass("Email2Jay")) {
			if($('#boxEmail').attr('checked') && this.value.match(/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/gi)==null){
				ErrorType = "Email";
			}
		}
		if($(this).hasClass("Password")) {
			if(this.value.match(/^(?=.{7,})(((?=.*[a-z])(?=.*[0-9]))).*$/g)==null){
				ErrorType = "Password";
			}
		}
		if($(this).hasClass("isNumber")) {
			//this.value = this.value.replace(/,/g,".");
			if(isNaN(this.value)){
				ErrorType = "isNumber";
			}
		}
		if($(this).hasClass("Select")) {
			if(this.options[this.selectedIndex].value==""){
				ErrorType = "Select";
			}
		}




		if(this.className.indexOf("Date")>=0){
			if(this.className.indexOf("Day")>=0){
				if(isNaN(this.value) || this.value.length>2 || this.value>31){
					ErrorType = 'DateDay';
				}	
			}
			if(this.className.indexOf("Month")>=0){
				if(isNaN(this.value) || this.value.length>2 || this.value>12){
					ErrorType = 'DateMonth';
				}	
			}
			if(this.className.indexOf("Year")>=0){
				if(isNaN(this.value) || this.value.length!=4){
					ErrorType = 'DateYear';
				}	
			}
		}
		
		if(ErrorType!=""){
			if(!$(this).hasClass("Error")) {
				$(this).after(htmlErrorMsg(ErrorType));
			}
			$(this).addClass("Error");
			bolSubmitForm = false;
		}
		else if($(this).hasClass("Error"))
		{
			$(this).removeClass("Error");
			this.parentNode.childNodes[1].style.display="none";
			//bolSubmitForm = true;
		}
		else
		{
			if(bolSubmitForm) bolSubmitForm = true;
		}
	});




	$(".Req2Jay").each(function(){
		ErrorType = "";
		if($(this).hasClass("Text2Jay")){
			if($('#boxEmail').attr('checked') && this.value.match(/[A-Za-z0-9]/gi)==null){
				ErrorType = "Text";
			}
		}
		if($(this).hasClass("Email2Jay")) {
			if($('#boxEmail').attr('checked') && this.value.match(/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/gi)==null){
				ErrorType = "Email";
			}
		}

		
		if(ErrorType!=""){
			if(!$(this).hasClass("Error")) {
				$(this).after(htmlErrorMsg(ErrorType));
			}
			$(this).addClass("Error");
			bolSubmitForm = false;
		}
		else if($(this).hasClass("Error"))
		{
			$(this).removeClass("Error");
			this.parentNode.childNodes[1].style.display="none";
			//bolSubmitForm = true;
		}
		else
		{
			if(bolSubmitForm) bolSubmitForm = true;
		}
	});



	if(bolSubmitForm) {
		//$("#"+FormId).submit();
		return true;
	}
	else
	{
		return false;
	}
}


var ErrorMsgId = 0;
function htmlErrorMsg(errType) {
	var strErrorMsg = "";
	switch(errType) {
		case 'Text':
			strErrorMsg = "<b>Dette felt skal udfyldes!</b><br />Venligst udfyld feltet.";
			break;
		case 'Email':
			strErrorMsg = "<b>Formatet p&aring; e-mail adressen er ikke korrekt!</b><br />Venligst udfyld feltet med en gyldig e-mail address.";
			break;
		case 'Password':
			strErrorMsg = "Dit kodeord skal v&aelig;re mindst 8 karakterer langt, og det skal indeholde b&aring;de tal og bogstaver.";
			break;
		case 'DateDay':
			strErrorMsg = "<b>The day format is not correct!</b><br />Please type in a number between 1 and 31";
			break;
		case 'DateMonth':
			strErrorMsg = "<b>The month format is not correct!</b><br />Please type in a number between 1 and 12 ";
			break;
		case 'DateYear':
			strErrorMsg = "<b>The year format is not correct!</b><br />Please type in a 4 digit number.";
			break;
		case 'isNumber':
			strErrorMsg = "<b>Dette felt m&aring; kun indehold tal!</b><br />Venligst udfyld feltet med et nummer.";
			break;
		case 'Select':
			strErrorMsg = "<b>Intet valgt!</b><br />Venligst v&aelig;lg et punkt p&aring; listen.";
			break;
	}
	strOutput = '<div class="ErrorIcon" style="position:relative;">';
	strOutput += '<a href="javascript:void(0)" onmouseover="showErrMsg('+ErrorMsgId+',1)" onmouseout="showErrMsg('+ErrorMsgId+',0)"><img src="/Files/System/Share/JavaScript/FormValidator/FormFieldErrorInfoIcon.gif" width="16" height="16" border="0"></a>';
	strOutput += '<div class="ErrorMsg'+ErrorMsgId+' ErrDisplay Hide" style="position:absolute; z-index:2;"><img src="/Files/System/Share/JavaScript/FormValidator/FormFieldErrorInfoBoxArrow.gif" style="position:absolute; z-index:1; left:-6px; top:7px;" />'+strErrorMsg+'</div></div>';
	ErrorMsgId++;
	return strOutput;
}
































































function showErrMsg(displayNum,displayState) {
	if(displayState==1) {
		$(".ErrorMsg"+displayNum).removeClass("Hide")
	}
	else
	{
		$(".ErrorMsg"+displayNum).addClass("Hide")
	}
}
































































































































