
function CheckEmailaddress(ea){
	// assume address is valid
	valid = true;
	ea = ea.toLowerCase();
	if(String(ea) != ""){
		// check email address syntax
		if(ea == null) valid = true;
		else if(ea.indexOf("@") < 2) valid = false;
		else if(ea.indexOf("@") != ea.lastIndexOf("@")) valid = false;
		else if(ea.length - ea.lastIndexOf(".") < 3) valid = false;
		else if(ea.substr(ea.indexOf("@")+1,ea.length-1).indexOf(".") < 2) valid = false;
	
		// make sure the last set set of chars only contain alpha chars
		s = ea.substr(ea.lastIndexOf(".")+1,ea.length-1);
		for(i = 0 ; i < s.length ; i++){
			if(s.charCodeAt(i) < 97 || s.charCodeAt(i) > 122) valid = false;
		}
	
		// make sure the chars before the @ are valid (charCodes 33-57,65-90,95,97-122)
		s = ea.substr(0,ea.indexOf("@"));
		for(i = 0 ; i < s.length ; i++){
			c = s.charCodeAt(i);
			if(c == 95 || (c >= 33 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122)) ;
			else {
				valid = false;
				break;
			}
		} 
		if (valid == false){
		msg = "Please fill out a valid email-address!";
			alert (msg);
		}
	}
}

function sendContac(){
	var msg = "";
	String(document.forms['doos'].contact.value)=="" ? msg += "- Contact person\n" : "";

	if (msg != ""){
		msg = "Fill out these fields:\n\n" + msg;
		alert (msg);
	}
	else{
		document.forms['doos'].submit();
	}

}

