function isEmail(elm){ 
	if (elm.value.indexOf("@") != "-1" &&
		elm.value.indexOf(".") != "-1" &&
		elm.value != "")
	return true;
	else return false;
}
function isFilled(elm){
	if (elm.value == "" ||
		elm.value == null)
	return false;
	else return true;
}

function isReady(tributeform){        
		// Check for valid email address in Part 1, assuming it is filled.
		if (isFilled(tributeform.email) == true && isEmail(tributeform.email) == false) {
		alert("The E-mail address entered in Part 1 is not valid. Please recheck the address and try again.");
		tributeform.email.focus();
		return false;
	}
		// Check for either donor's name or anonymouse title in Part 5.
		if ((isFilled(tributeform.donor_fname) || isFilled(tributeform.donor_mi) || isFilled(tributeform.donor_lname)) == false && isFilled(tributeform.anontitle) == false){
		alert("Please enter the donor's name or an anonymous listing title in Part 5.");
		tributeform.donor_fname.focus();
		return false;
	}
		// Check for tribute text OR tribute attachment in Part 6.
		if ((isFilled(tributeform.tributetext) == false) && (isFilled(tributeform.att_doc) == false)) {
		alert("Please enter tribute text in Part 6 or attach an appropriate file. Otherwise, your submission will be blank.");
		tributeform.tributetext.focus();
		return false;
	}
	
return true;
}


function autoFill(){       
	// Autofill country in Part 8 if US state is selected above.
	if ( document.tributeform.mail_state.selectedIndex == 3 ){
	document.tributeform.mail_country.selectedIndex = 1;
	   	return true;
	} else {
		document.tributeform.mail_country.selectedIndex = 0;
		return true;
	}
}
