
	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 == '' && strRequired == '') 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( 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( 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 == '') err=0;
		
		if (err==1){
			alert( "" + strCaptionForNotNumericField + "" );	
			document.forms[strFormName][strFieldName].focus();
			return true;
		}
			return false;
	}
//______________________________________________________________________________________________________________

	function IsRadioButtonFormSelected(frmOptionButtonForm, strOptionGroupName, strAlertCaption) {
		myOption = -1;
		for (i=document.forms[frmOptionButtonForm][strOptionGroupName].length-1; i > -1; i--) {
		if (document.forms[frmOptionButtonForm][strOptionGroupName][i].checked) {
		myOption = i; i = -1;
		}
		}
		if (myOption == -1) {
			alert(strAlertCaption);
			return false;
		}
			return true;
	}
//______________________________________________________________________________________________________________

	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 == '' && strRequired == '') err=0
		
		if (err==1) {
			alert(" Ugyldig tidsangivelse - Indtast gyldig tid i feltet - " + strCaptionForNotValidTime + "" );
			document.forms[strFormName][strFieldName].focus();
			return true;
		}
		return false;
	}
//__________________________________________________________________________________________________________________________

	function IsValueNotBetween(strFormName, strFieldName, intMinValue, intMaxValue, strCaptionForNotRightValue, intRequired){

		var valInputValue = document.forms[strFormName][strFieldName].value;
		var err=0;
		var numericExpression = /^[0-9]+$/;
			

		if (!valInputValue.match(numericExpression)) err=1;

		if (valInputValue <= intMinValue) err=1;
		if (valInputValue >= intMaxValue) err=1;

		if (valInputValue == '' && intRequired == '') err=0;

		if (err==1) {
			alert("" + strCaptionForNotRightValue + "");
			document.forms[strFormName][strFieldName].focus();
			return true;
		}
		return false;
	}
//__________________________________________________________________________________________________________________________
	
	function OpenVideoWin(strURL){
		var myWin;
		//myWin = window.open(strURL, "_blank", "directories=no,height=500,left=100,location=no,menubar=no,resizable=no,scrollbars=no,status=0,title=0,toolbar=no,top=100,width=660");
		myWin = window.open(strURL, "_blank", "height=425,left=100,location=no,top=100,width=520");
	}
//__________________________________________________________________________________________________________________________

	function OpenHelpWin(strURL){
		var myWin;
		myWin = window.open(strURL, "_blanl", "directories=no,height=2000,left=2000,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,title=no,toolbar=no,top=30,width=400");
	}
//__________________________________________________________________________________________________________________________

	function PrintPage() {
		window.print();
	}
//______________________________________________________________________________________________________________

	function ConfirmStop(strMessageCaption) { 
		alert(strMessageCaption);
		return false;
	}
//______________________________________________________________________________________________________________

	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;
	}
//______________________________________________________________________________________________________________


