function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function emailvalidation(entered, alertbox)
{
	with (entered)
	{
	apos=value.indexOf("@"); 
	dotpos=value.lastIndexOf(".");
	lastpos=value.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
	{if (alertbox) {alert(alertbox);} return false;}
	else {return true;}
	}
}

function formvalidation(thisform)
{
with (thisform)
{
if (emptyvalidation(namn,"Var vänlig skriv in ditt namn")==false) {namn.focus(); return false;};
if (emptyvalidation(email,"Var vänlig skriv in din e-postadress")==false) {email.focus(); return false;};
if (emailvalidation(email,"Försäkra dig om att din e-mail adress är korrekt!")==false) {email.focus(); return false;};
if (emptyvalidation(meddelande,"Ooops meddelandefältet är tydligen tomt, jag tycker det vore toppen om du skrev något där")==false) {meddelande.focus(); return false;};
}
} 