<!--

document.InputForm.action = "http://sdmines.sdsmt.edu/cgi-bin/global/send_message_2.cgi";

var vDay

// Used for passing name value pairs
	function getParm(string,parm)
	{
	    // returns value of parm from string
	
	    var startPos = string.indexOf(parm + "=");
	    if (startPos > -1) 
	    {
	        startPos = startPos + parm.length + 1;
	        var endPos = string.indexOf("&",startPos);
	        if (endPos == -1)
	            endPos = string.length;
	        return unescape(string.substring(startPos,endPos));
	    }
	    return '';
	}
	
	var passed = location.search.substring(1);
	
	document.InputForm.Source.value = getParm(passed,'Source');

function initit()
{
	
	document.InputForm.SportSelected.value = getParm(passed,'Sport');
	if (document.InputForm.SportSelected.value == "")
	{
		document.InputForm.Sport.selectedIndex = 0;
	}
	else
	{
		document.InputForm.Sports.checked = true;
		if (document.InputForm.SportSelected.value == "MBB")
			document.InputForm.Sport.selectedIndex = 1;
		if (document.InputForm.SportSelected.value == "MXC")
			document.InputForm.Sport.selectedIndex = 2;
		if (document.InputForm.SportSelected.value == "FB")
			document.InputForm.Sport.selectedIndex = 3;
		if (document.InputForm.SportSelected.value == "MG")
			document.InputForm.Sport.selectedIndex = 4;
		if (document.InputForm.SportSelected.value == "MT")
			document.InputForm.Sport.selectedIndex = 5;
		if (document.InputForm.SportSelected.value == "WBB")
			document.InputForm.Sport.selectedIndex = 6;
		if (document.InputForm.SportSelected.value == "WXC")
			document.InputForm.Sport.selectedIndex = 7;
		if (document.InputForm.SportSelected.value == "WG")
			document.InputForm.Sport.selectedIndex = 8;
		if (document.InputForm.SportSelected.value == "WT")
			document.InputForm.Sport.selectedIndex = 9;
		if (document.InputForm.SportSelected.value == "VB")
			document.InputForm.Sport.selectedIndex = 10;
	}

}

//	function enableBus()
//	{

//		if (document.InputForm.vmDay[0].checked)
//		vDay = "July 18, 2008";
//		alert (vDay);
//		{
//			if (document.all || document.getElementByid)
//			{
//			document.InputForm.vmBus[0].disabled = false
//			document.InputForm.vmBus[1].disabled = false
//			}
//			document.InputForm.vmBus[0].focus();
//			return false;
//		}
//		if (document.InputForm.vmDay[1].checked)
//		{
//			if (document.all || document.getElementByid)
//			{
//			document.InputForm.vmBus[0].disabled = true
//			document.InputForm.vmBus[0].checked = false
//			document.InputForm.vmBus[1].disabled = true
//			document.InputForm.vmBus[1].checked = false
//			}
//			document.InputForm.vmDay[1].focus();
//			return false;
//		}	
		
//		return true;
//	}

function validit()
{

//Timestamp
		stamp = new Date();
		document.InputForm.Stamp.value = stamp;

// Used for not authorized.
	if (document.InputForm.miners.value != '')
		document.InputForm.action = "http://interact.sdsmt.edu/not-authorized.asp";

// Student Information required
   if(document.InputForm.FirstName.value == "")
   {
      alert("Please enter the first name of the student.");
      document.InputForm.FirstName.focus();
      return false;
   }

   if(document.InputForm.LastName.value == "")
   {
      alert("Please enter the last name of the student.");
      document.InputForm.LastName.focus();
      return false;
   }

   if(document.InputForm.Address.value == "")
   {
      alert("Please enter your address.");
      document.InputForm.Address.focus();
      return false;
   }

   if(document.InputForm.City.value == "")
   {
      alert("Please enter the city.");
      document.InputForm.City.focus();
      return false;
   }

  if (document.InputForm.State.selectedIndex == 0)
  {
    alert("Please select the state.");
    document.InputForm.State.focus();
    return (false);
  }

   if(document.InputForm.Zip.value == "")
   {
      alert("Please enter the zip code.");
      document.InputForm.Zip.focus();
      return false;
   }

// validate email address
   if(document.InputForm.Email.value != "")
   {
      if(document.InputForm.Email.value.indexOf("@") == -1)
      {
         alert('Your email address is invalid it must contain @.');
         document.InputForm.Email.focus();
         return false;
      }  
   }

// validate IM address
   if(document.InputForm.IM.value != "")
   {
      if(document.InputForm.IM.value.indexOf("@") == -1)
      {
         alert('Your IM address is invalid it must contain @.');
         document.InputForm.IM.focus();
         return false;
      }  
   }
// phone or email required
   if(document.InputForm.Phone.value == "" && document.InputForm.Email.value == "")
   {
      alert("Please enter either a phone number or email address.");
      document.InputForm.Phone.focus();
      return false;
   }
// high school required
	if(document.InputForm.HighSchool.value == "")
	{
		alert("Please tell us where you went to high school.");
		document.InputForm.HighSchool.focus();
		return false;
	}

	if(document.InputForm.GradYear.value == "")
	{
		alert("Please tell us what year you graduated from high school.");
		document.InputForm.GradYear.focus();
		return false;
	}
	
// plan to enroll required
	if(document.InputForm.Enroll.selectedIndex == 0)
	{
		alert("Please tell us when you plan to enroll.");
		document.InputForm.Enroll.focus();
		return false;
	}
		   
// Major
// at least 1 degree required
	if (document.InputForm.Program1.selectedIndex==0)
	{
		alert("Please select at least one program.")
		document.InputForm.Program1.focus();
		return false;
	}

// Visit Mines Department
	if (document.InputForm.vmDay.checked == true && document.InputForm.vmDepartment.selectedIndex==0)
	{
		alert("Please select the department open house you would like to attend during Visit Mines.")
		document.InputForm.vmDepartment.focus();
		return false;
	}

// Tell us how you heard of us required
  if (document.InputForm.Referral.selectedIndex == 0)
  {
    alert("Please tell us how you heard about us.");
    document.InputForm.Referral.focus();
    return false;
  }	

// Email Body

	em = '<p style="font-family: Arial; font-size: 10pt">';
	if (!document.InputForm.Visit.value == '')
	{
		em += '<b>Date and time of visit: </b>';
//		if(!document.InputForm.Visit.value == null)
//			em += '9:30 am - ';
			if(document.InputForm.Time[0].checked)
				em += '9:30 am - ';
			if(document.InputForm.Time[1].checked)
				em += '1:30 pm - ';
		em += document.InputForm.Visit.value + '<br>';
		em += '<b>Department to visit: </b>';
		em += document.InputForm.Department.value + '<br>';
		em += '<b>Coach to visit: </b>';
		em += document.InputForm.Coach.value + '<br>';
		em += '<b>Music Interest: </b>';
		em += document.InputForm.Music.value + '<br>';
		em += '<b>Number of Guests: </b>';
		em += document.InputForm.Guests.value + '<br>'; 
	}
	em += '<b>Require special assistance: </b>';
		if(document.InputForm.cvAssistance[0].checked || document.InputForm.vmAssistance[0].checked)
			em += 'Yes';
		else
			em += 'No';
	em += '</p>';
	em += '<table border="0" style="border-collapse: collapse; font-family: Arial; font-size: 10pt" cellpadding="5" width="665">';
	em += '<tr>';
	em += '<td valign="top">';
	em += '<b>Campus Visit Programs</b><br>';
//		if (document.InputForm.jpDay.checked)
//		{
//			em += 'Junior Preview Day - April 19, 2008</A><br>';
//			em += '&nbsp;&nbsp;&nbsp;Guests: ' + document.InputForm.jpGuests.value + '<br>';
//			em += '&nbsp;&nbsp;&nbsp;Names: ' + document.InputForm.jpNames.value + '<br>';
//		}

		if (document.InputForm.vmDay.checked == true || document.InputForm.vmBreakfast.checked == true)
		{
			em += 'Visit Mines Day - ';
			em += document.InputForm.vmDay.value + '<br>';
			em += 'Open House: ' + document.InputForm.vmDepartment.value + '<br>';
			em += '&nbsp;&nbsp;&nbsp;Guests: ' + document.InputForm.vmGuests.value + '<br>';
			em += '&nbsp;&nbsp;&nbsp;Names: ' + document.InputForm.vmNames.value + '<br>';
			if (document.InputForm.vmBreakfast.checked == true)
				em += 'You indicated you will be attending the Go Women Breakfast';
		}
//  Comment this out when there are no bus options
//		var radioSelected = false;
//		for (i = 0;  i < document.InputForm.vmBus.length;  i++)
//		{
//			if (document.InputForm.vmBus[i].checked)
//			radioSelected = true;
//		}
//		if (radioSelected)
//			{
//				em += 'Bus Reservation - ';
//				if(document.InputForm.vmBus[0].checked)
//					em += 'From Sioux Falls<br>';
//				if(document.InputForm.vmBus[1].checked)
//				em += 'From Mitchell<br>';
//			}
	em += '</td>';
	em += '<td valign="top">&nbsp;';
//  Comment this out when there are no Info Night Programs
//	em += 'Nights Programs';
//	em += '<b>Mines Info and Alumni Session';
//	em += '</b><br>';
//		var radioSelected = false;
//		for (i = 0;  i < document.InputForm.InfoNights.length;  i++)
//		{
//			if (document.InputForm.InfoNights[i].checked)
//			radioSelected = true;
//		}
//		if (radioSelected)
//		{
//			em += vInfoNights + '<br>';
//			em += '&nbsp;&nbsp;&nbsp;Guests: ' + document.InputForm.inGuests.value + '<br>';
//			em += '&nbsp;&nbsp;&nbsp;Names: ' + document.InputForm.inNames.value + '<br>';
//		}
	em += '</td>';
	em += '</tr>';
	em += '</table>';
	em += '<table border="0" style="border-collapse: collapse; font-family: Arial; font-size: 10pt" id="table2" cellpadding="5" width="665">';
	em += '	<tr>';
	em += '<td width=336 nowrap colspan="2" style="border-top: 2px solid #000080; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">&nbsp;</td>';
	em += '<td width="329" nowrap colspan="4" style="border-top: 2px solid #000080; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">&nbsp;</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td width="52"><b>Name:</b></td>';
	em += '<td width="284">' + document.InputForm.FirstName.value + ' ' + document.InputForm.LastName.value;
	if(document.InputForm.Perferred.value != "")
		em += ' (' + document.InputForm.Perferred.value + ')';
	em += '</td>';
	em += '<td width="321" colspan="4"><b>Date of Birth: </b>';
	em += document.InputForm.DOB.value;
	em += '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td width="52"><b>Address:</b></td>';
	em += '<td width="284">' + document.InputForm.Address.value + '</td>';
	em += '<td><b>Enroll: </b></td>';
	em += '<td colspan=3>' + document.InputForm.Enroll.value + '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td width="52"></td>';
	em += '<td width="284">' + document.InputForm.City.value + ', ' + document.InputForm.State.value + '  ' + document.InputForm.Zip.value + '</td>';
	em += '<td width="321" colspan="4"><b>High School: </b>';
	em += document.InputForm.HighSchool.value + '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td width="52"></td>';
	em += '<td width="284"></td>';
	em += '<td><b>Year: </b></td>';
	em += '<td>' + document.InputForm.GradYear.value + '</td>';
	em += '<td><b>GPA: </b></td>';
	em += '<td>' + document.InputForm.HSGPA.value + '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td width="52"><b>Phone:</b></td>';
	em += '<td width="284">' + document.InputForm.Phone.value + '</td>';
	em += '<td width="40"><b>ACT:</b> </td>';
	em += '<td width="69">' + document.InputForm.ACTComp.value + '</td>';
	em += '<td width="39"><b>SAT:</b> </td>';
	em += '<td width="168">' + document.InputForm.SATComb.value + '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td width="52"><b>Cell:</b></td>';
	em += '<td width="284">' + document.InputForm.Cell.value + '</td>';
	em += '<td width="40"><b>Math:</b></td>';
	em += '<td width="69">' + document.InputForm.ACTMath.value + '</td>';
	em += '<td width="39"><b>Math:</b> </td>';
	em += '<td width="168">' + document.InputForm.SATMath.value + '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td><b>Email</b></td>';
	em += '<td width="284">' + document.InputForm.Email.value + '</td>';
	em += '<td><b>Gender:</b></td>';
	em += '<td colspan=3>';
	if (document.InputForm.Gender[0].checked == true)
		em += 'Male';
	if (document.InputForm.Gender[1].checked == true)
		em += 'Female';
	em += '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td width="52"><b>IM:</b></td>';
	em += '<td width="284">' + document.InputForm.IM.value + '</td>';
	em += '<td><b>Ethnicity:</b></td>';
	em += '<td colspan=3>';
	if (document.InputForm.Ethnic[0].checked == true)
		em += 'American Indian or Alaskan Native';
	if (document.InputForm.Ethnic[1].checked == true)
		em += 'Hispanic';
	if (document.InputForm.Ethnic[2].checked == true)
		em += 'Asian or Pacific Islander';
	if (document.InputForm.Ethnic[3].checked == true)
		em += 'White, not of Hispanic origin';
	if (document.InputForm.Ethnic[4].checked == true)
		em += 'Black, not of Hispanic origin';
	if (document.InputForm.Ethnic[5].checked == true)
		em += 'Other';
	em += '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td colspan="6"><b>My family attended SDSM&T: </b>';
	em += '<blockquote style="margin-top: 0; margin-bottom: 0">';
		if (document.InputForm.Mother.checked == true)
			if(document.InputForm.Father.checked == true || document.InputForm.Sister.checked == true || document.InputForm.Brother.checked == true || document.InputForm.Grandparent.checked == true || document.InputForm.AuntUncle.checked == true)
				em += 'Mother, ';
			else
				em +='Mother';
		if (document.InputForm.Father.checked == true)
			if (document.InputForm.Sister.checked == true || document.InputForm.Brother.checked == true || document.InputForm.Grandparent.checked == true || document.InputForm.AuntUncle.checked == true)
				em += 'Father, ';
			else
				em += 'Father';
		if (document.InputForm.Sister.checked == true)
			if (document.InputForm.Brother.checked == true || document.InputForm.Grandparent.checked == true || document.InputForm.AuntUncle.checked == true)
				em += 'Sister, ';
			else
				em += 'Sister';
		if (document.InputForm.Brother.checked == true)
			if (document.InputForm.Grandparent.checked == true || document.InputForm.AuntUncle.checked == true)
				em += 'Brother, ';
			else
				em += 'Brother';
		if (document.InputForm.Grandparent.checked == true)
			if (document.InputForm.AuntUncle.checked == true)
				em += 'Grandparent, ';
			else
				em += 'Grandparent';
		if (document.InputForm.AuntUncle.checked == true)	
		em += 'Aunt/Uncle';
	em += '</blockquote>';
	em += '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td colspan="6">';
	em += '<table border="0" style="border-collapse: collapse; font-family: Arial; font-size: 10pt" width="100%">';
	em += '<tr>';
	em += '<td width="30%"><b>Parent Name: </b>';
	em += document.InputForm.P1Name.value + '</td>';
	em += '<td width="40%"><b>Email: </b>';
	em += document.InputForm.P1Email.value + '</td>';
	em += '<td width="30%"><b>Phone: </b>';
	em += document.InputForm.P1Phone.value + '</td>';
	em += '</tr>';
	em += '<tr>';
	em += '<td><b>Parent Name: </b>';
	em += document.InputForm.P2Name.value + '</td>';
	em += '<td><b>Email: </b>';
	em += document.InputForm.P2Email.value + '</td>';
	em += '<td><b>Phone: </b>';
	em += document.InputForm.P2Phone.value + '</td>';
	em += '</tr>';
	em += '</table>';
	em += '</td>';
	em+= '</tr>';
	em += '<tr>';
	em += '<td colspan="2" valign="top"><br>';
	em += '<b>Primary Program Choice:</b>';
	em += '<blockquote style="margin-top: 0; margin-bottom: 0">';
	em += document.InputForm.Program1.value;
	em += '</blockquote>';
	em += '<br><br><b>Secondary Program Choice:</b>';
	em += '<blockquote style="margin-top: 0; margin-bottom: 0">';
	em += document.InputForm.Program2.value;
	em += '</blockquote></td>';
	em += '<td width="319" colspan="4" valign="top"><br>';
	em += '<b>Activities:</b>';
	em += '<blockquote style="margin-top: 0; margin-bottom: 0">';
	if (document.InputForm.Sports.checked == true)
		em += 'Intercollegiate Sports - ' + document.InputForm.Sport.value + '<br>';
	if (document.InputForm.Clubs.checked == true)
		em += 'Clubs and Organizations<br>';
	if (document.InputForm.Academic.checked == true)
		em += 'Academic Organizations<br>';
	if (document.InputForm.Greek.checked == true)
		em += 'Greek Organizations<br>';
	if (document.InputForm.Honor.checked == true)
		em += 'Honor Societies<br>';
	if (document.InputForm.Multicultural.checked == true)
		em += 'Multicultural Organizations<br>';
	if (document.InputForm.Government.checked == true)
		em += 'Student Government<br>';
	if (document.InputForm.Arts.checked == true)
		em += 'Visual and Performing Arts<br>';
	em += '</blockquote></td>';
	em += '</tr>';
	em += '</table>';
	em += '<p style="font-family: Arial; font-size: 10pt">';
	em += '<b>Heard about us: </b> ' + document.InputForm.Referral.value;
	em += '</p><p style="font-family: Arial; font-size: 10pt">';
	em += '<b>College(s) attended: </b>' + document.InputForm.Colleges.value;
	em += '</p><p style="font-family: Arial; font-size: 10pt">';
	em += '<b>Comments: </b>' + document.InputForm.OtherComments.value;
	em += '</p>';

   document.InputForm.email_body.value = em;

// Email header information

   from = document.InputForm.Email.value;
   document.InputForm.email_from.value = from;
   
//   to = 'Vickie.Bender@sdsmt.edu';
//   to = 'Tamara.Martinez-Anderson@sdsmt.edu';
   to = 'admissions@sdsmt.edu';
   document.InputForm.email_to.value = to;

   cc = document.InputForm.Email.value;
   document.InputForm.email_cc.value = cc;

	if(document.InputForm.Visit.value == '')
		subj = 'Information Request';
	else
	   subj = document.InputForm.Visit.value + ' - Visit Mines';
   document.InputForm.email_subject.value = subj;

// Confirmation page 

	confurl = 'http://interact.sdsmt.edu/admissions/request-confirm.asp';

	if (document.InputForm.Sport.selectedIndex == 1)
		confurl = 'http://interact.sdsmt.edu/athletics/mbb.asp';
	if (document.InputForm.Sport.selectedIndex == 2)
		confurl = 'http://interact.sdsmt.edu/athletics/txc.asp';
	if (document.InputForm.Sport.selectedIndex == 3)
		confurl = 'http://interact.sdsmt.edu/athletics/fb.asp';
	if (document.InputForm.Sport.selectedIndex == 4)
		confurl = 'http://interact.sdsmt.edu/athletics/golf.asp';
	if (document.InputForm.Sport.selectedIndex == 5)
		confurl = 'http://interact.sdsmt.edu/athletics/txc.asp';
	if (document.InputForm.Sport.selectedIndex == 6)
		confurl = 'http://interact.sdsmt.edu/athletics/wbb.asp';
	if (document.InputForm.Sport.selectedIndex == 7)
		confurl = 'http://interact.sdsmt.edu/athletics/txc.asp';
	if (document.InputForm.Sport.selectedIndex == 8)
		confurl = 'http://interact.sdsmt.edu/athletics/golf.asp';
	if (document.InputForm.Sport.selectedIndex == 9)
		confurl = 'http://interact.sdsmt.edu/athletics/txc.asp';
	if (document.InputForm.Sport.selectedIndex == 10)
		confurl = 'http://interact.sdsmt.edu/athletics/vb.asp';

	document.InputForm.confirm.value = confurl;

   return true;

}

//-->