/*
 *  File:  mailForm0.js
 *
 *  Note:  This script has been deprecated (use mailForm1.js instead)
 *
 *  Send e-mail to selected addresses
 *
 *  Example 1:  mailForm0Test1.html
 *
 *    <script type="text/javascript"
 *            src="http://www.bgsu.edu/scripts/mailForm0.js">
 *    </script>
 *    <script type="text/javascript">
 *      recipients[1] = 
 *        new Recipient( "Admissions Office", "admissions@bgnet.bgsu.edu" );
 *      recipients[2] = 
 *        new Recipient( "Human Resources", "ohr@bgnet.bgsu.edu" );
 *      recipients[3] = 
 *        new Recipient( "Registration and Records", "registrar@bgnet.bgsu.edu" );
 *      recipients[4] = 
 *        new Recipient( "Tech Support Center", "tsc@bgnet.bgsu.edu" );
 *      recipients[5] = 
 *        new Recipient( "Webmaster", "webmaster@bgnet.bgsu.edu" );
 *    </script>
 *    <!-- Put this link in the <body> of your document -->
 *    <a href="javascript:openMailForm()">Contact us!</a>
 *
 *  Example 2:  mailForm0Test2.html
 *
 *    <script type="text/javascript"
 *            src="http://www.bgsu.edu/scripts/mailForm0.js">
 *    </script>
 *    <script type="text/javascript">
 *      recipients[1] = 
 *        new Recipient( "Webmaster", "webmaster@bgnet.bgsu.edu" );
 *    </script>
 *    <!-- Put this form in the <body> of your document -->
 *    <form>
 *      <input type="button" value="Contact the Webmaster!" onclick="openMailForm()">
 *    </form>
 *
 *  Note:  According to the HTML 4.0 specification, the <form> is not needed,
 *         but a lone <input> tag will not render in Netscape Navigator 4.
 *
 */

// Allow documents within the bgsu.edu domain to utilize this script:
//document.domain = "bgsu.edu";

// User-defined variables:
var width, height;

// A Window object:
var _mailFormWin;

// Open the mail form window:
function openMailForm() {
  // Local variables:
  var url = "http://www.bgsu.edu/scripts/mailForm0.html";
  var winName = "mailFormWindow";
  // Both variables must be specified to override the defaults:
  if ( !width || !height ) {
    width = 465; height = 375;
  }
  // Build window features list:
  var features = "width=" + width;
  features += ",height=" + height;
  features += ",scrollbars,resizable";
  // Open the window:
  _mailFormWin = window.open( url, winName, features );
  // Give it focus:
  _mailFormWin.focus();
  // Relax security restrictions on the new window:
  //_mailFormWin.document.domain = "bgsu.edu";
}

// Close mail form window, if it exists:
function closeMailForm() {
  if ( _mailFormWin != null ) _mailFormWin.close();
  _mailFormWin = null;
}

// Recipient object constructor:
function Recipient( name, email ) {
  this.name = name;
  this.email = email;
}

// A user-specified array of e-mail recipients:
var recipients = new Array();

// Write the <option> elements into the mail form window:
function writeOptions() {
  var name, email;
  recipients[0] = new Recipient( "Choose a recipient:", "" );
  for ( var i = 0; i < recipients.length; i++ ) {
    name = recipients[i].name;
    email = recipients[i].email;
    _mailFormWin.document.writeln( '' );
    _mailFormWin.document.write( '<option value="' + email + '">' );
    _mailFormWin.document.write( name );
    _mailFormWin.document.writeln( '</option>' );
  }
}