
	function DoesCompareTwoFieldsFail(strFormName, strFieldName, strFormName2, strFieldName2, strEmailFieldCaption) {
		if (document.forms[strFormName][strFieldName].value != document.forms[strFormName2][strFieldName2].value){
			alert( strEmailFieldCaption );
			document.forms[strFormName2][strFieldName2].focus();
			return true;
		}
			return false;
	}


//__________________________________________________________________________________________________________________________


	function DoesFieldSpecificLenghtFail(strFormName, strFieldName, intMinNoOfCharacters, intMaxNoOfCharacters, strCaptionForNotRightLenght){
		var valInput = document.forms[strFormName][strFieldName].value;
		
		if(valInput.length >= intMinNoOfCharacters && valInput.length <= intMaxNoOfCharacters){
			return false;
		}else{
			alert("" + strCaptionForNotRightLenght + "");
			document.forms[strFormName][strFieldName].focus();
			return true;
		}
	}


//__________________________________________________________________________________________________________________________
	

	function emailFunk(fEmail) {
		return fEmail.replace("b238787mnb327idsjb","@")
	}


//__________________________________________________________________________________________________________________________


	function IsCheckBoxUnChecked(strFormName, strCheckBoxName, strAlertCaption) {
		if (document.forms[strFormName][strCheckBoxName].checked == false) {
			alert("" + strAlertCaption + "" );
			document.forms[strFormName][strCheckBoxName].focus();
			return true;
		}
		else { return false; }
	}

//__________________________________________________________________________________________________________________________


	function IsDateInvalid(strFormName, strFieldName, strCaptionForNotValidDate, strRequired) {
		var err=0 ;
		a=document.forms[strFormName][strFieldName].value;

		if (a.length != 10) err=1 
		b = a.substring(6, 10) // År
		c = a.substring(2, 3) // '-'
		d = a.substring(3, 5) // Måned
		e = a.substring(5, 6) // '-'
		f = a.substring(0, 2) // Dag
		k = a.substring(8, 10) // Siste 2 siffer i år, f.eks 98 i 1998
		
		if (b<1900 || b>9999) err = 1 //gyldig år?
		if (c != '-') err = 1
		if (d<1 || d>12) err = 1
		if (e != '-') err = 1
		if (f<1 || f>31) err = 1
		if (d==4 || d==6 || d==9 || d==11) { 
		if (f==31) err=1 
		}
		if (d==2) {
		var g=parseInt(k/4)
		if (isNaN(g)) { 
		err=1 
		}
		if (f>29) err=1
		if (f==29 && ((k/4)!=parseInt(k/4)))
		err=1
		}
	
		if (a.length == 0 && strRequired.lenght == 0 ) err=0;
	
		if (err==1) {
			alert("Ugyldig dato - Indtast gyldig dato i feltet - " + strCaptionForNotValidDate + "" );
			document.forms[strFormName][strFieldName].focus();
			return (true);
		}
			return (false);
		}
	

//__________________________________________________________________________________________________________________________
	

	function IsEmailInvalid(strFormName, strFieldName, strEmailFieldCaption) {
		varValue = document.forms[strFormName][strFieldName].value;
		t="\\wÃ¡Ã Ã£Ã¢Ã¢Ã¦Ã¥Ã§Ã©Ã¨ÃªÃ«Ã¬Ã­Ã®Ã¯Ã±Ã²Ã³Ã´ÃµÃ¶Ã¸Ã¹ÃºÃ»Ã¼Ã½Ã¿";
		regexp=new RegExp("^["+t+"]["+t+"\\.\\-]*@["+t+"]["+t+"\\.\\-]*\\.[a-z]{2,6}$","i");
		if(!regexp.test(varValue)||/(\.@|\-@|@\.|@\-|\-\-|\.\.|\-\.|\.\-)/g.test(varValue)) {
			alert("Indtast en gyldig E-mail i feltet " + strEmailFieldCaption + "");
			document.forms[strFormName][strFieldName].focus();
			return true;
		}
			return false;
	}

			
//__________________________________________________________________________________________________________________________


	function IsEmpty(strFormName, strFieldName, strAlertCaption) {
		if ((document.forms[strFormName][strFieldName].value.length==0) ||
		 (document.forms[strFormName][strFieldName].value==null)) {
			if (!strAlertCaption=='') alert( "Du skal udfylde feltet - " + strAlertCaption + "" );
			document.forms[strFormName][strFieldName].focus();
		return true;
		}
		else { return false; }
	}

//__________________________________________________________________________________________________________________________


	function IsNotNumeric(strFormName, strFieldName, strCaptionForNotNumericField, strRequired){
		var a, err, numericExpression = /^[0-9]+$/;
			a=document.forms[strFormName][strFieldName].value;
			
		if (!a.match(numericExpression)) err=1;
		if (a == '' && strRequired == '0') err=0;
		
		if (err==1){
			alert( "" + strCaptionForNotNumericField + "" );	
			document.forms[strFormName][strFieldName].focus();
			return true;
		}
			return false;
	}


//______________________________________________________________________________________________________________

	function IsTimeInvalid(strFormName, strFieldName, strCaptionForNotValidTime, strRequired) {
		var a,b,c,f,err=0;
			a=document.forms[strFormName][strFieldName].value;

		if (a.length != 5) err=1;
		b = a.substring(0, 2);
		c = a.substring(2, 3); 
		f = a.substring(3, 5); 
		if (/\D/g.test(b)) err=1; //not a number
		if (/\D/g.test(f)) err=1; 
		if (b<0 || b>23) err=1;
		if (f<0 || f>59) err=1;
		if (c != ':') err=1;

		if (a.length == 0 && strRequired.lenght == 0) err=0
		
		if (err==1) {
			alert(" Ugyldig tidsangivelse - Indtast gyldig tid i feltet - " + strCaptionForNotValidTime + "" );
			document.forms[strFormName][strFieldName].focus();
			return true;
		}
		return false;
	}

//__________________________________________________________________________________________________________________________
	

	function SetFocus(strFormName, strFieldName) {
		document.forms[strFormName][strFieldName].focus();
	}


//______________________________________________________________________________________________________________


	function ValidateConfirm(strMessageCaption) { 
		intAnswer = confirm("" + strMessageCaption + "")
		if (intAnswer !=0) { 
			return true;
		} 
			return false;
	}


//______________________________________________________________________________________________________________


	function ValidateDelete(strMessageCaption) { 
		intAnswer = confirm("Vil du slette " + strMessageCaption + "")
		if (intAnswer !=0) { 
			return true;
		} 
			return false;
	}


//______________________________________________________________________________________________________________
