//Function to validate before submitting first page.
function validateone() {
    	
    	if (document.myform.firstname.value.length < 1) {
	    window.alert("Please enter your first name.");
		myform.firstname.focus()
		return false;
	}
  
	if (document.myform.lastname.value.length < 1) {
	    window.alert("Please enter your last name.");
		myform.lastname.focus()
		return false;
	}

  	if (document.myform.streetaddress.value.length < 3) {
	    window.alert("Please enter your street address.");
		myform.streetaddress.focus()
		return false;
	}

	if (document.myform.city.value.length < 1) {
	    window.alert("Please enter your city.");
		myform.city.focus()
		return false;
	}

	if (document.myform.state.value.length < 1) {
	    window.alert("Please enter your state.");
		myform.state.focus()
		return false;
	}

	var emailaddress = document.myform.emailaddress.value;	
	if ( (emailaddress.indexOf("@") ==-1) || (emailaddress.indexOf(".") ==-1) ) {
	    window.alert("Please enter a valid email address.");
		myform.emailaddress.focus()
		return false;
	}

	if (document.myform.telephonenumber.value.length < 1) {
	    window.alert("Please enter your telephone number.");
		myform.telephonenumber.focus()
		return false;
	}

// else
// {return true;}

// return true;

}


//Function to print form.
function validate() {
    	
    	if (document.myform.firstname.value.length < 1) {
	    window.alert("Please enter your first name.");
		myform.firstname.focus()
		return false;
	}
  
	if (document.myform.lastname.value.length < 1) {
	    window.alert("Please enter your last name.");
		myform.lastname.focus()
		return false;
	}

  	if (document.myform.streetaddress.value.length < 3) {
	    window.alert("Please enter your street address.");
		myform.streetaddress.focus()
		return false;
	}

	if (document.myform.city.value.length < 1) {
	    window.alert("Please enter your city.");
		myform.city.focus()
		return false;
	}

	if (document.myform.state.value.length < 1) {
	    window.alert("Please enter your state.");
		myform.state.focus()
		return false;
	}

	var emailaddress = document.myform.emailaddress.value;	
	if ( (emailaddress.indexOf("@") ==-1) || (emailaddress.indexOf(".") ==-1) ) {
	    window.alert("Please enter a valid email address.");
		myform.emailaddress.focus()
		return false;
	}

	if (document.myform.telephonenumber.value.length < 1) {
	    window.alert("Please enter your telephone number.");
		myform.telephonenumber.focus()
		return false;
	}

//	return true;
	ViewForm();
}

  function thanks() { 
	answer = prompt("Enter \'Y\' if you want to submit this e-mail","")
	  if (answer.toUpperCase() == "Y") 
	  { alert("Thanks for your interest!");
	    return true;
	   } 
	  else 
	  { return false;} 
	} 
				 
     function ViewForm() {
	newWin = window.open('','cart','width=628,height=500,status=no,resizable=yes,scrollbars=yes,left=65,top=5,screenX=65,screenY=5');

	newWin.document.write("<HTML>");
	newWin.document.write("<BODY>");
	
	newWin.document.write('<div align="center"><TABLE border="0" width="595" cellpadding="5" cellspacing="0">');

//	newWin.document.write('<tr><td colspan="3"><font size="5" face="BD Merced, Trebuchet MS, Arial, Helvetica, sans-serif">Your Inquiry Regarding </font></td>');
//	newWin.document.write('<tr><td colspan="3"><font size="5" face="BD Merced, Trebuchet MS, Arial, Helvetica, sans-serif">the &nbsp;<b>"' + myform.ministry.value + '" ministry</b></td></TR>');
//	newWin.document.write('<tr><td colspan="3"><font size="5" face="BD Merced, Trebuchet MS, Arial, Helvetica, sans-serif">will be forwarded to St. Joseph\'s Parish.</td></TR>');
//	newWin.document.write('<tr><td colspan="3"><font size="5" face="BD Merced, Trebuchet MS, Arial, Helvetica, sans-serif">Your Inquiry Regarding the <b>"' + myform.ministry.value + '" </b>ministry will be forwarded to St. Joseph\'s Parish.</font></td></tr>');
	newWin.document.write('<tr><td colspan="3"><font size="5" face="BD Merced, Trebuchet MS, Arial, Helvetica, sans-serif">Please click &quot;Submit Query&quot; to forward your inquiry regarding the <b>"' + myform.ministry.value + '" </b>ministry to St. Joseph\'s Parish.</font></td></tr>');

		
//	newWin.document.write('<tr height="10"><td colspan="3"><br></td></tr>');
	newWin.document.write('<tr><td colspan="3"><font size="2" face="Trebuchet MS, Arial, Helvetica, sans-serif">Please verify your personal information. If you need to make a correction, please <A href="#" onClick="window.close()"> close this window</a> and return to the previous page. Otherwise, please submit your query now. If you prefer, you can <a href="#" onClick="window.print()">print</a> this page and mail or bring it to the Parish at 114 N. Lincoln Ave., Round Lake, IL 60073.<br></font></td></tr>');
	newWin.document.write('<tr><td><font size="3" face="Trebuchet MS, Arial, Helvetica, sans-serif"><b>Name &amp; Address</b></td><TD><font size="3" face="Trebuchet MS, Arial, Helvetica, sans-serif"><b>Telephone</b></font></TD><TD><font size="3" face="Trebuchet MS, Arial, Helvetica, sans-serif"><b>E-Mail</b></font></TD></TR>');
	newWin.document.write('<TR><TD><font size="2" face="Trebuchet MS, Arial, Helvetica, sans-serif">' + myform.firstname.value + '&nbsp;' + myform.lastname.value + '&nbsp;(' + myform.age.value +')</font>');	

	newWin.document.write('</TD><TD><font size="2" face="Trebuchet MS, Arial, Helvetica, sans-serif">' + myform.telephonenumber.value +'</font>');	
	newWin.document.write('</td><TD><font size="2" face="Trebuchet MS, Arial, Helvetica, sans-serif">' + myform.emailaddress.value +'</font>');	

	newWin.document.write('</TD></TR><TR><TD colspan="3"><font size="2" face="Trebuchet MS, Arial, Helvetica, sans-serif">' + myform.streetaddress.value +'</font>');
	newWin.document.write('</TD></TR><tr><td colspan="3"><font size="2" face="Trebuchet MS, Arial, Helvetica, sans-serif">' + myform.city.value + '&nbsp;&nbsp;' + myform.state.value + '&nbsp;&nbsp;' + myform.zip.value + '</font></td></tr>');
	newWin.document.write('<TR><TD colspan="3"><font size="3" face="Trebuchet MS, Arial, Helvetica, sans-serif"><b>Comments/Special Skills</b></font></TD></TR>');
	newWin.document.write('<TR><TD colspan="3"><font size="2" face="Trebuchet MS, Arial, Helvetica, sans-serif">' + myform.comments.value +'</font></TD></TR>');
	newWin.document.write('<TR><TD colspan="3"><font size="3" face="Trebuchet MS, Arial, Helvetica, sans-serif"><b>' + myform.contact.value +'</b></font></TD></TR>');

//	newWin.document.write('<tr><td colspan="3" align="center"><font size="5" face="BD Merced, Trebuchet MS, Arial, Helvetica, sans-serif">Thank you, ' + myform.firstname.value + '&nbsp;' + myform.lastname.value + ', for your interest!</font></td></tr>');
// **************************** NOTE: TO TEST, USE MY EMAIL ADDRESS: *************** 
//	newWin.document.write('<TR align="right"><td colspan="3"><FORM name="myform" method="post" action="mailto:candycorner@ameritech.net?subject=TESTING Ministry Opportunities Inquiry" enctype="text/plain" onSubmit="return true;">');

	newWin.document.write('<TR align="right"><td colspan="3"><FORM name="myform" method="post" action="mailto:stjoseph-lincoln@archchicago.org?subject=Ministry Opportunities Inquiry" enctype="text/plain" onSubmit="return true;">');
	
	newWin.document.write('<INPUT type="hidden" name="firstname" value="');
	newWin.document.write(myform.firstname.value + '">');
	newWin.document.write('<INPUT type="hidden" name="lastname" value="');
	newWin.document.write(myform.lastname.value + '">');
	newWin.document.write('<INPUT type="hidden" name="streetaddress" value="');
	newWin.document.write(myform.streetaddress.value + '">');
	newWin.document.write('<INPUT type="hidden" name="city" value="');
	newWin.document.write(myform.city.value + '">');
	newWin.document.write('<INPUT type="hidden" name="state" value="');
	newWin.document.write(myform.state.value + '">');
	newWin.document.write('<INPUT type="hidden" name="zip" value="');
	newWin.document.write(myform.zip.value + '">');
	newWin.document.write('<INPUT type="hidden" name="emailaddress" value="');
	newWin.document.write(myform.emailaddress.value + '">');
	newWin.document.write('<INPUT type="hidden" name="telephonenumber" value="');
	newWin.document.write(myform.telephonenumber.value + '">');

	newWin.document.write('<INPUT type="hidden" name="age" value="');
	newWin.document.write(myform.age.value + '">');
	newWin.document.write('<INPUT type="hidden" name="ministry" value="');
	newWin.document.write(myform.ministry.value + '">');
	newWin.document.write('<INPUT type="hidden" name="comments" value="');
	newWin.document.write(myform.comments.value + '">');


	newWin.document.write('<INPUT type="hidden" name="contact" value="');
	newWin.document.write(myform.contact.value + '">');
	newWin.document.write('<INPUT type="submit" value="Submit Query">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<input type="button" VALUE="Print Form" onClick="window.print()">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</FORM>');
	newWin.document.write('</td></tr>');

	newWin.document.write('<tr><td colspan="3" align="center"><font size="5" face="BD Merced, Trebuchet MS, Arial, Helvetica, sans-serif">Thank you, ' + myform.firstname.value + '&nbsp;' + myform.lastname.value + ', for your interest!</font></td></tr>');

	newWin.document.write("</div></TABLE>");
	newWin.document.write("</BODY>");
	newWin.document.write("</HTML>");
	newWin.document.close();
//	thanks();
//	return true;
	} 

