// JavaScript Document
fromEmail="";
message="";
person=0;
function setHovers() {
	
var daImage = document.getElementById("menuHome");
daImage.onmouseover = function () { this.src="http://annapolis.quaker.org/images/AMFHomeDeselected.jpg"}
daImage.onmouseout = function () {this.src="http://annapolis.quaker.org/images/AMFHome.jpg"}

}

function closeIt() {
  window.close();
  }
function updateData(ItemID){
	familyValues= document.getElementById(ItemID).value;
	switch (ItemID)
	{case "thePerson":
	person = familyValues;
	break
	case "theEmail":
	fromEmail = familyValues;
	break
	case "theMessage":
	message = familyValues;
	break
	}
	
  }
  
  
function sendIt(daDude, daWord, daDigits) {
  if (daDude==0) {
	  var goAhead=confirm("You did not pick a recipient. Do you want to send a message to info@annapolis.quaker.org?");
	  if (! goAhead) return;
  }
  if (daWord.length<1 || daWord=="") {
	  alert("Message field left blank. Message not sent.");
	  return;
  }
  if (daWord.indexOf("<")>-1 || daWord.indexOf(">") > -1) {
      alert("Coding characters such as '<' or '>' are not allowed in the message body.");
	  return;
  }
  if (daDigits.length<1 || daDigits=="") {
	  var goAhead=confirm("We encourage you to give us your e-mail address so we can respond. Do you want to send your e-mail anyway?");
	  if (! goAhead)  return;
	  daDigits='"No e-mail given" <info@annapolis.quaker.org>';
	  fromEmail=daDigits;
	  document.getElementById("theEmail").value= daDigits;
  }
  var doom = daDigits.indexOf("@");
  var destruction = daDigits.indexOf(".");
 if ( doom<1 || destruction<1) {
	  var goAhead=confirm("Your e-mail address is not valid. We encourage you to give us a valid e-mail address so we can respond. Do you want to send your e-mail anyway?");
	  if (! goAhead)  return;																					
  }
  document.getElementById("AFMemailer").submit();
  /*var stringURL = "contact.php";
 // var stringURL = "contact.php?person="+daDude;  // see if it works just as a post
  window.location=stringURL;
  */
  }
function contactWindow(person) {
  if (! person) person = 0;
  myWindow=window.open('','emailer','scrollbars=no,menubar=no,height=400,width=800,resizable=yes,toolbar=no,location=no,status=no');
  myWindow.document.open("text/html");
myWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"');
myWindow.document.write('"http://www.w3.org/TR/html4/loose.dtd">');
myWindow.document.write('<html>');
myWindow.document.write('<head>');
myWindow.document.write('<title>Annapolis Friends Meeting E-mail Sender</title>');
myWindow.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
myWindow.document.write('<link href="style00.css" rel="stylesheet" type="text/css">');
myWindow.document.write('<script src="quakerJava.js" type="text/javascript" language="javascript"></script>');
myWindow.document.write('</head>');
myWindow.document.write('<body >');
myWindow.document.write('<form name="AFMemailer" id="AFMemailer" action="contact.php" method="POST" >'); // enctype="multipart/form-data"
myWindow.document.write('<h2>Send us an E-mail!</h2>');
myWindow.document.write('<table border="2" cellpadding="0">');
myWindow.document.write('<tr>');
myWindow.document.write('<td>Please select a person to send an e-mail to:</td>');
var selectText=new Array;
selectText[255]="";
for (var i=0;i<13;i++) {selectText[i]=""};
selectText[person]=" selected ";

myWindow.document.write('<td><select name="person" id="thePerson" onchange="updateData(this.id)">' );
myWindow.document.write('<option value="0"'+selectText[0]+'>Please select a person from the list below</option>');
myWindow.document.write('<option value="1"'+selectText[1]+'>Elise Albert, Clerk of Annapolis Friends Meeting</option>');
myWindow.document.write('<option value="2"'+selectText[2]+'>Wes Jordan, Assistant Clerk, AFM</option>');
myWindow.document.write('<option value="3"'+selectText[3]+'>Joel Rodkin, Treasurer</option>');
// myWindow.document.write('<option value="4"'+selectText[4]+'>, Assistant Treasurer</option>');
myWindow.document.write('<option value="5"'+selectText[5]+'>Phyllis Singer, Recording Clerk</option>');
myWindow.document.write('<option value="6"'+selectText[6]+'>Glenn Singer, Recorder</option>');
// this option no longer visible, subscriptions by e-mail through Mary Barbera
// myWindow.document.write('<option value="7"'+selectText[7]+'>Stephanie DeAbreu, mailing-list subscriptions</option>');
myWindow.document.write('<option value="8"'+selectText[8]+'>Pat Schenck, Clerk, Outreach Committee</option>');
myWindow.document.write('<option value="9"'+selectText[9]+'>Phil Favero, Clerk, Peace and Social Concerns Committee</option>');
myWindow.document.write('<option value="10"'+selectText[10]+'>Phil Caroom, Newsletter editor</option>');
myWindow.document.write('<option value="11"'+selectText[11]+'>Leo Pickens, Building Use Coordinator</option>');
myWindow.document.write('<option value="255"'+selectText[255]+'>Ken Mayer, webmanager</option>');
myWindow.document.write('</select></td>');
myWindow.document.write('</tr>');
myWindow.document.write('<tr>');
myWindow.document.write('<td>Your e-mail address:</td>');
myWindow.document.write('<td><input name="fromEmail" type="text" size="30" id="theEmail" onchange="updateData(this.id)"></td>');
myWindow.document.write('</tr>');
myWindow.document.write('<tr>');
myWindow.document.write('<td>Your message:</td>');
myWindow.document.write('<td>&nbsp;</td>');
myWindow.document.write('</tr>');
myWindow.document.write('<tr>');
myWindow.document.write('<td colspan="2"><textarea name="message" cols="80" rows="6" id="theMessage" onchange="updateData(this.id)"></textarea></td>');
myWindow.document.write('</tr>');
myWindow.document.write('<tr>');
myWindow.document.write('<td><input name="Cancelling" type="button" class="rubricked" onClick="closeIt()" value="Cancel this e-mail"></td>');
myWindow.document.write('<td><input name="Sending" type="button" class="rubricked" onClick="sendIt(thePerson.value, theMessage.value, theEmail.value)" value="Send this e-mail"></td>');
myWindow.document.write('</tr>');
myWindow.document.write('</table>');
myWindow.document.write('</form>');
myWindow.document.write('</body>');
myWindow.document.write('</html>');
myWindow.focus();
  }
