function checkSubmit() {
	// this function verifies that the user has filled out all the fields
	// provided 5 unique, valid email addresses
	var msg = "";
	var dup = "";
	if (document.thisForm.DVDName.value == "") {
		msg = msg + "Name\n";
	}
	if (document.thisForm.City.value == "") {
		msg = msg + "City\n";
	}
	if (document.thisForm.State.value == "") {
		msg = msg + "State / Country\n";
	}
	if (document.thisForm.Phone.value == "") {
		msg = msg + "Phone\n";
	}if (checkEmail(document.thisForm.Email.value) == 0) {
		msg = msg + "Your Email\n";
	}if (document.thisForm.fn1.value == "") {
		msg = msg + "First Name #1 \n";
	}if (checkEmail(document.thisForm.E1.value) == 0) {
		msg = msg + "Email #1 \n";
	}if (document.thisForm.fn2.value == "") {
		msg = msg + "First Name #2 \n";
	}if (checkEmail(document.thisForm.E2.value) == 0) {
		msg = msg + "Email #2 \n";
	}if (document.thisForm.fn3.value == "") {
		msg = msg + "First Name #3 \n";
	}if (checkEmail(document.thisForm.E3.value) == 0) {
		msg = msg + "Email #3 \n";
	}if (document.thisForm.fn4.value == "") {
		msg = msg + "First Name #4 \n";
	}if (checkEmail(document.thisForm.E4.value) == 0) {
		msg = msg + "Email #4 \n";
	}if (document.thisForm.fn5.value == "") {
		msg = msg + "First Name #5 \n";
	}if (checkEmail(document.thisForm.E5.value) == 0) {
		msg = msg + "Email #5 \n";
	}
	
	if (msg == "") {
		var tmp1 = "";
		var tmp2 = "";
		tmp1 = document.thisForm.Email.value;
		tmp2 = document.thisForm.E1.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Your Email and Email #1 \n";
		}
		tmp2 = document.thisForm.E2.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Your Email and Email #2 \n";
		}
		tmp2 = document.thisForm.E3.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Your Email and Email #3 \n";
		}
		tmp2 = document.thisForm.E4.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Your Email and Email #4 \n";
		}
		tmp2 = document.thisForm.E5.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Your Email and Email #5 \n";
		}

		tmp1 = document.thisForm.E1.value;
		tmp2 = document.thisForm.E2.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #1 and Email #2 \n";
		}
		tmp2 = document.thisForm.E3.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #1 and Email #3 \n";
		}
		tmp2 = document.thisForm.E4.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #1 and Email #4 \n";
		}
		tmp2 = document.thisForm.E5.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #1 and Email #5 \n";
		}
		tmp1 = document.thisForm.E2.value;
		tmp2 = document.thisForm.E3.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #2 and Email #3 \n";
		}
		tmp2 = document.thisForm.E4.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #2 and Email #4 \n";
		}
		tmp2 = document.thisForm.E5.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #2 and Email #5 \n";
		}
		tmp1 = document.thisForm.E3.value;
		tmp2 = document.thisForm.E4.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #3 and Email #4 \n";
		}
		tmp2 = document.thisForm.E5.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #3 and Email #5 \n";
		}
		tmp1 = document.thisForm.E4.value;
		tmp2 = document.thisForm.E5.value;
		if (tmp1.toLowerCase() == tmp2.toLowerCase() ) {
			dup = dup + "Email #4 and Email #5 \n";
		}
	}
	if (msg.length > 0 || dup.length > 0) {
		if (msg.length > 0) {
			msg = "Please Enter Valid Data in the Following Fields: \n\n" + msg;
		}
		if (dup.length > 0) {
			dup = "\n\nThe Following Email Addresses are duplicates: \n\n" + dup;
		}
		alert(msg + dup);
	}
	else {
		//alert ("Document Submitted");
		document.thisForm.submit();
	}
}	// --- end of checkSubmit

function checkEmail(theEmail) {
	if (theEmail.length > 5) {
		if (theEmail.indexOf('@') == -1) {
			return 0;
		}
		else {
			var dmn;
			dmn = theEmail.substring(theEmail.indexOf('@', 0) + 1);
			if (dmn.indexOf('.') == -1) {
				return 0; 				
			}
			else {
				return 1;
			}
		}
	}	
	else {
		return 0;
	}

}	// end of checkEmail

