
function egg() {
	window.open('easterEgg.asp','_blank','toolbar=no,status=no,resizable=no,scrollbars=no,left=100,top=100,screenX=100,screenY=100,width=270,height=270');
}

// ---------------------------------------------------------------
// --->  This function validates an e-mail address structure  <---
// --->  If the address is invalid it presents and alert      <---
// --->  Returns 'true' or 'false'                            <---
// ---------------------------------------------------------------

function emailValidation(entered, alertbox) {
	with (entered) {
		apos = value.indexOf("@");
		dotpos = value.lastIndexOf(".");
		lastpos = value.length - 1;
		if (apos < 1 || dotpos - apos < 2 || lastpos - dotpos > 6 || lastpos - dotpos < 2) {
			if (alertbox) {
				alert(alertbox);
			}
			return false;
		}
		else {
			if (value.indexOf("@") != value.lastIndexOf("@")) {
				if (alertbox) {
					alert(alertbox);
				}
				return false;
			}
			else {
				return true;
			}
		}
	}
}


// --------------------------------------------------------
// --->  This function checks if a formfield is empty  <---
// --->  If the field is empty it presents and alert   <---
// --->  Returns 'true' or 'false'                     <---
// --------------------------------------------------------

function emptyValidation(entered, alertbox) {
	with (entered)
	{
		if (value == null || value == "") {
			if (alertbox != "") {
				alert(alertbox);
			}
			return false;
		}
		else {
			return true;
		}
	}
}


// --------------------------------------------------------
// --->  This function checks if a formfield is empty  <---
// --->  If the field is empty it presents and alert   <---
// --->  Returns 'true' or 'false'                     <---
// --------------------------------------------------------

function passwordValidation(password, passwordRetype, alertbox) {
	if (password.value != passwordRetype.value) {
		if (alertbox != "") {
			alert(alertbox);
		}
		return false;
	}
	else {
		return true;
	}
}


// -----------------------------------------------------------------------
// --->  This function checks if a button in a radiogroup is checked  <---
// --->  If no button is checked it presents and alert                <---
// --->  Returns 'true' or 'false'                                    <---
// -----------------------------------------------------------------------

function radiogroupValidation(entered, alertbox) {
	with (entered)
	{
		for (var i = 0; i < entered.length; i++) {
			if (entered[i].checked)
				return true;
		}
		if (alertbox != "") {
				alert(alertbox);
		}
		return false;
	}
}


// -------------------------------------------------------------
// --->  This function checks if a dropdownbow is selected  <---
// --->  If no button is checked it presents and alert      <---
// --->  Returns 'true' or 'false'                          <---
// -------------------------------------------------------------

function dropdownboxValidation(entered, alertbox) {
	with (entered)
	{
		if (entered.options[entered.selectedIndex].value != "0") {
			return true;
		}
		if (alertbox != "") {
			alert(alertbox);
		}
		return false;
	}
}


// -------------------------------------------------------------------------------------------
// --->  This function checks if a texareas text is to large, greater than 102.399 bytes  <---
// --->  If a text in a field is to large it presents and alert                           <---
// --->  Returns 'true' or 'false'                                                        <---
// -------------------------------------------------------------------------------------------

function maxsizeValidation(entered, alertbox) {
	if (entered.length <= 102399) {
		return true;
	}
	if (alertbox != "") {
		alert(alertbox + "\n\nIndholdet er lige nu på " + entered.length + " tegn.\nDet maksimale antal tilladte tegn er 102.399!");
	}
	return false;
}


// -------------------------------------------------------------------------------------------
// --->  This function checks for correctness of a danish cpr-number                      <---
// --->  If the number is invalid the function presents and alert                         <---
// --->  Returns 'true' or 'false'                                                        <---
// -------------------------------------------------------------------------------------------

function cprValidation(entered, alertbox) {
	if (entered.value.length != 11) {
		alert(alertbox);
		return false;
	}
	for (i = 0; i < 11; i++) {
		if (i == 6) {
			if (entered.value.charAt(i) != "-") {
				alert(alertbox);
				return false;
			}
		}
		else {
			if ((entered.value.charAt(i) > "9") || (entered.value.charAt(i) < "0")) {
				alert(alertbox);
				return false;
			}
		}
	}
	return true;
}


// -------------------------------------------------------------------------------------------
// --->  This function checks if a field is a correct integer                             <---
// --->  If the number is invalid the function presents an alert                          <---
// --->  Returns 'true' or 'false'                                                        <---
// -------------------------------------------------------------------------------------------

function integerValidation(entered, alertbox) {
	if (entered.value.length <= 0) {
		alert(alertbox);
		return false;
	}
	else {
		for (i = 0; i < entered.value.length; i++) {
			if ((entered.value.charAt(i) > "9") || (entered.value.charAt(i) < "0")) {
				alert(alertbox);
				return false;
			}
		}
	}
	return true;
}