// Disable back
javascript:window.history.forward(1);

function checkForm()
{

var doc = document.InputForm;

//Timestamp
	stamp = new Date();
	doc.Stamp.value = stamp;

// Required Information

   if (doc.PFirst.value.replace(/\s+/,'') == "")
   {
      alert ('Please enter your first name.');
      doc.PFirst.focus();
      return false;
   }

   if (doc.PLast.value.replace(/\s+/,'') == "")
   {
      alert ('Please enter your last name.');
      doc.PLast.focus();
      return false;
   }

	if (doc.Email.value.replace(/\s+/,'') == "")
	{
		alert ('Please enter your email address.');
		doc.Email.focus();
		return false;
	}

   if (!doc.Email.value.replace(/\s+/,'') == "")
   {
      if (doc.Email.value.indexOf("@") == -1)
      {
         alert ('Your email address is invalid it must contain @.');
         doc.Email.focus();
         return false;
      }  
   }

   if (doc.SFirst.value.replace(/\s+/,'') == "")
   {
      alert ('Please enter the first name of the student.');
      doc.SFirst.focus();
      return false;
   }

   if (doc.SLast.value.replace(/\s+/,'') == "")
   {
      alert ('Please enter  the last name of the student.');
      doc.SLast.focus();
      return false;
   }


// Email header information

	// replaces HPCNet User as label for http@barney.hpcnet.org.
	document.InputForm.email_from_name.value = 'SDSM&T';
	
	// for reply to
   from = 'reslife@sdsmt.edu';
   document.InputForm.email_from.value = from;


	to = 'Maureen.Wilson@sdsmt.edu';
	cc = document.InputForm.Email.value;

	document.InputForm.email_to.value = to;
	document.InputForm.email_cc.value = cc;
	
   subj = 'Parent Email Sign up';
   document.InputForm.email_subject.value = subj;

// Email Body

	em = '<TABLE border="1" style="border-collapse: collapse" cellpadding="10" bordercolor="#FFCC00" width="600">';
	em += '<TR>';
	em += '<TD>';
	em += '<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="#111111" WIDTH="100%">';
	em += '<TR>';
	em += '<TD ALIGN="center">';
	em += '<FONT size="5"><B>Parent Email Sign up<BR></B></FONT><B>South Dakota School of Mines and Technology</B></TD>';
	em += '</TR>';
	em += '</TABLE>';
	em += '</TD>';
	em += '</TR>';
	em += '<TR>';
	em += '<TD>';
	em += '<TABLE border="0" style="border-collapse: collapse;" id="table2" cellpadding="3">';
	em += '<TR>';
	em += '<TD align="right">&nbsp;</TD>';
	em += '<TD>Parent:</TD>';
	em += '<TD><B>';
	em += document.InputForm.PFirst.value + ' ' + document.InputForm.PLast.value;
	em += '</B></TD>';
	em += '</TR>';
	em += '<TR>';
	em += '<TD align="right">&nbsp;</TD>';
	em += '<TD>Email:</TD>';
	em += '<TD><B>';
	em += document.InputForm.Email.value;
	em += '</B></TD>';
	em += '</TR>';
	em += '<TR>';
	em += '<TD align="right">&nbsp;</TD>';
	em += '<TD>Student:</TD>';
	em += '<TD><B>';
	em += document.InputForm.SFirst.value + ' ' + document.InputForm.SLast.value;
	em += '</B></TD>';
	em += '</TR>';
	em += '<TR>';
	em += '</TABLE>';
	em += '</TD>';
	em += '</TR>';
	em += '</TABLE>';

   doc.email_body.value = em;

   confurl = 'http://interact.sdsmt.edu/reslife/parent_email_confirm.htm';
   document.InputForm.confirm.value = confurl;

   return true;

}
