function isEmailAddr(email){
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0){
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}




//Name and Email Validation.
function join(){
		var check=true;
		var error="You failed to complete the following compulsory fields;\n\n";
		if (document.forms[0].elements['EMAIL'].value=="") { error+="EMAIL\n";check=false;}
		if (document.forms[0].elements['EMAIL'].value==""){alert("Din e-post måste anges.");return(false);}
		if (!isEmailAddr(document.forms[0].elements['EMAIL'].value)){alert("Please enter a complete email address in the form: yourname@yourdomain.com");return(false);}
		//if (document.forms[0].elements['name'].value=="") { error+="NAME\n";check=false;}
		if (error!="You failed to complete the following compulsory fields;\n\n"){alert(error);}
		return check;			
		}
