	var err = 0;

	function empty(str, field){
		if(str=='' || str.length==0 || str==' '){
			return 'Af '+field+' kan ikke være tom.\n';
		}
		return '';
	}

	function checkMail(str, showAlert){
		if(!isMail(str)){
			if(showAlert==true)
				alert('E-mail-adresse i ikke korrekt.');
			err = 1;
			return false;
		}
		return true;
	}

	function isMail(mail){
		var x = mail;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x))
			return true;
		else
			false;
	}

	/**
	 *
	 * @access public
	 * @return void
	 **/
	function dId(str){
		return document.getElementById(str);
	}

	function checkForm(){
		err = 0;
		//'Af '+field+' kan ikke være tom'
		errors = empty(dId('fname').value, 'Fornavn');
		errors = errors+ empty(dId('lname').value, 'Efternavn');

		if(checkMail(dId('email').value, false)==true || checkMail(dId('email2').value, false)==true){
			if(dId('email').value!=dId('email2').value){
				errors = errors + 'E-mail-adressen skal være identisk.';
			}
		}
		else{
			errors = errors+ 'E-mail-adresse i ikke korrekt.';
		}
		if(errors=='')
			document.forms[0].submit();
		else
			alert(errors);
	}

//set todays date
Now = new Date();
//NowDay = Now.getDate();
//NowMonth = Now.getMonth();
//NowYear = Now.getYear();
NowYear = 1900;

//function for returning how many days there are in a month including leap years
function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
  if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
  if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
  return DaysInMonth;
}

//function to change the available days in a months
function ChangeOptionDays(Which)
{
  DaysObject = eval("document.Form1." + Which + "Day");
  MonthObject = eval("document.Form1." + Which + "Month");
  YearObject = eval("document.Form1." + Which + "Year");

  Month = MonthObject[MonthObject.selectedIndex].text;
  Year = YearObject[YearObject.selectedIndex].text;

  DaysForThisSelection = DaysInMonth(Month, Year);
  CurrentDaysInSelection = DaysObject.length;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      DaysObject.options[DaysObject.options.length - 1] = null
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
    {
      NewOption = new Option(DaysObject.options.length + 1);
      DaysObject.add(NewOption);
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}

//function to set options to today
function SetToToday(Which)
{
  DaysObject = eval("document.Form1." + Which + "Day");
  MonthObject = eval("document.Form1." + Which + "Month");
  YearObject = eval("document.Form1." + Which + "Year");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which);

  DaysObject[NowDay-1].selected = true;
}

//function to write option years plus x
function WriteYearOptions(YearsAhead, current)
{
  line = "";
  for (i=1; i<=100; i++)
  {
    if(current==(YearsAhead - i))
			line += "<OPTION selected='selected' >";
		else
			line += "<OPTION>";

    line += YearsAhead - i + "</OPTION>";
  }
  return line;
}