if (top.location != location) {
	top.location.href = document.location.href;
}

function isEmail(str) {
	// are regular expressions supported?
	var supported = 0;
	if (window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported)
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}

function validateContact() {

	if (document.formContact.company.value.length < 3) {
		alert('Indtast venligst firmanavn!');
		document.formContact.company.focus();
		return false;
	}

	if (document.formContact.contact.value.length < 3) {
		alert('Indtast venligst dit navn!');
		document.formContact.contact.focus();
		return false;
	}

	if (document.formContact.contact.value.indexOf(' ') == -1) {
		alert('Indtast venligst både og for og efternavn!');
		document.formContact.contact.focus();
		return false;
	}

	if (document.formContact.phone.value.length < 8) {
		alert('Indtast venligst telefonnummer!');
		document.formContact.phone.focus();
		return false;
	}

	if (!isEmail(document.formContact.email.value)) {
		alert('Indtast venligst en korrekt e-mailadresse!');
		document.formContact.email.focus();
		return false;
	}

	if (document.formContact.subject.value == '') {
		alert('Vælg venligst emne!');
		document.formContact.subject.focus();
		return false;
	}

	if (document.formContact.text.value.length < 3) {
		alert('Indtast besked til os!');
		document.formContact.text.focus();
		return false;
	}

}