function parseemail(){
	var emailentry=document.contactus.email.value;
	var emailaddress = new Array();
	var comma = ',';
	var x = 1;
	
	for (k=1; k <=100; k++){
		emailaddress[k]='';
	}
	
	
	for(i=0; i<emailentry.length; i++){
		iscomma = (emailentry.charAt(i));
		if (iscomma != ','){
			emailaddress[x] = emailaddress[x] + iscomma;
		}
		else {
			x = x + 1;
		}
	}
	for (j=1; j <=x; j++){
		//alert(emailaddress[j]);
		verifyemail(emailaddress[j]);
	}	
}
function verifyemail(emailaddy){
	emailinvalid = 0;
	// BEGIN EXAMINATION OF EMAIL ADDRESS
	//emailaddy=document.emailfriend.toemail.value;
	
	//check for disallowed characters
	invalids=" /:;,";
	for(i=0; i<invalids.length; i++){
	characto=(invalids.charAt(i));
		if (emailaddy.indexOf(characto) != -1){
			emailinvalid = 1;
			}
		}

		//check for @, skip first character
		atindex= emailaddy.indexOf("@",1)
		if (atindex == -1){
			emailinvalid = 1;
		}
		//check for only one @
		if (emailaddy.indexOf("@",atindex+1) != -1){
			emailinvalid = 1;
		}
		//check for dot after @
		dotindex=emailaddy.indexOf(".",atindex+1)
		if (dotindex == -1){
		    emailinvalid = 1;
		}
		//check for at least 2 chars after dot
		if ((dotindex+3) > emailaddy.length) {
			emailinvalid = 1;
		}
	
	if (emailinvalid == 1 & error == 0){
		errors = "Please make sure that your entry has your email address in the standard format (name@address.com)";
		alert(errors);
		error = 1;
		document.contactus.email.select();
		document.contactus.email.focus();
	}
}


function submitit() {
error = 0;
	if (document.supers.firstname.value=="") {
		alert('Please enter your first name.');
		error=1;
		document.supers.firstname.focus();
	}
	if (document.supers.lastname.value=="" & error == 0) {
			alert('Please enter your last name.');
			error=1;
			document.supers.lastname.focus();
	}

	if (document.supers.email.value=='' & error == 0){
		error = 1;
		alert ('Please enter your email address.');
		document.supers.email.focus();
	}
	
	
	
	if (error == 0) {
		document.supers.submit();
		//alert("submit form");
	}
}
