// Alumni Select Destination
/* This program alters the destination of the form depending on the program or degree selected 
   and prevents the submission of the form if a program is not selected.
   This program also prevents the user from picking the same student group twice.
   03/21/07 New program DAC*/
function selectDestination()
{
 var one = checkStudentGroup(); /* check for duplicate student groups */	
 if (one == true)
 {
program=document.forms[0].program
 txt=""
 switch(program.selectedIndex)
        {
         case 1:  /* J.D. */
           txt = "lawalum@bu.edu"
		   break    
         case 2:  /* LL.M. in American Law  */
           txt = "lawalum@bu.edu,ofp@bu.edu"
           break    
         case 3:  /* LL.M. in Banking Law */
           txt = "lawalum@bu.edu,banklaw@bu.edu"
           break    
         case 4:  /* LL.M. in Tax Law */
           txt = "lawalum@bu.edu,gradtax@bu.edu"
           break    
         default:  /* None of the above, error */
           alert("Please select a program.");
           return false; /* Stop submission of the form */
        }
       document.getElementById("to").value = txt	/* Change the destination of the form */
       return true; /* Allow the form to be submitted */
 }
 else
    {return false;} /* duplicate student groups */
}
function checkStudentGroup()
{
/* alert(document.alumniform.studentgroup1.value+"\n"+document.alumniform.studentgroup2.value+"\n"+document.alumniform.studentgroup3.value+"\n"+document.alumniform.journals.value); */	
 if (document.alumniform.studentgroup1.value != "No student group selected")
    {
	 if (document.alumniform.studentgroup1.value == document.alumniform.studentgroup2.value || document.alumniform.studentgroup1.value == document.alumniform.studentgroup3.value)
	    {
         alert("You have selected the same group more than once."+"\n"+"Please review your student group choices.*");
		 return false; /* Stop submission of the form */
	    }
    }
 if (document.alumniform.studentgroup2.value != "No student group selected")
    {
     if (document.alumniform.studentgroup2.value == document.alumniform.studentgroup1.value || document.alumniform.studentgroup2.value == document.alumniform.studentgroup3.value)
	    {
         alert("You have selected the same group more than once."+"\n"+"Please review your student group choices.**");
		 return false; /* Stop submission of the form */
	    }
    }
return true;
}
