// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// fcnSubmitNote - submit the email note via the popup box.									 //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
function fcnSubmitNote() {
  var dtDate = new Date();
  dtDate.setTime(dtDate.getTime()+120000);	// Cookies expire in about 120 seconds...
  
  var ok = 1;
  var str = "height=300,innerHeight=300,width=450,innerWidth=450"
  	str += ",left=" + ((screen.availWidth - 10) / 3) + ",screenX=" + ((screen.availWidth - 10) / 3);
  	str += ",top=0,screenY=0,dependent,menubar=0,resizable=0,location=0,scrollbars=1";
  var strSendTo = document.getElementById("strSendTo");
  var strName = document.getElementById("strName");
  var strEmail = document.getElementById("strEmail");
  var strMessage = document.getElementById("strMessage");
  var strWHO = document.getElementById("strWHO");
  
  var strFields = "";
  
  if (strName.value == "") { strFields += "   Your Name\n"};
  if (strEmail.value == "") { strFields += "   Your Email\n"};
  if (strMessage.value == "") { strFields += "   Message\n"};

  if (strFields != "") {
	alert("The following items must be filled in:\n\n" + strFields + "\n");
	document.all.strName.focus();
	ok = 0;
  }
  else {
  	if (strEmail.value.indexOf("@") == -1) {
  		alert("'Your Email' does not appear to be a valid email address.\n\nPlease correct before submitting.");
		document.all.strEmail.focus();
	 	ok = 0;
  	}
  }
  
  if (ok == 1) {
	if (strSendTo!=null) {
		document.cookie = "sendnote_strSendTo=" + escape(strSendTo.value) + "; expires=" + dtDate.toGMTString() + "; path=/";
	};
	document.cookie = "sendnote_strName=" + escape(strName.value) + "; expires=" + dtDate.toGMTString() + "; path=/";
	document.cookie = "sendnote_strEmail=" + escape(strEmail.value) + "; expires=" + dtDate.toGMTString() + "; path=/";
	document.cookie = "sendnote_strMessage=" + escape(strMessage.value) + "; expires=" + dtDate.toGMTString() + "; path=/";
	document.cookie = "sendnote_WHO=" + escape(strWHO.value) + "; expires=" + dtDate.toGMTString() + "; path=/";
	document.cookie = "sendmail_action=sendnote.asp; expires=" + dtDate.toGMTString() + "; path=/";
	var windowRef = window.open("sendmail.asp", "SendNote", str);
  	try {
	  	windowRef.focus();
		strName.value = "";
		strEmail.value = "";
		strMessage.value = "";
		return true;
		}
	catch(e) {
		alert('It appears you may have a Popup Blocker active.\n\nPlease allow popups from this website before clicking the submit button.');
		return false;
		}
  	}
}

