//                                               filename: setmirror2.js
//
//
//     "Setting e-print archive mirrors, part 2"
//
//  JavaScript code Copyright 1999 by David R. Morrison.
//  
//  Permission is granted to use this code freely, provided that the code
//  -- including comments and copyright notice -- is reproduced completely, 
//  that no modifications are made other than setting the correct value of
//  the variable "whichForm", and that the author David R. Morrison 
//  is notified by email <drm@math.duke.edu> of all such uses.
//
//  Version 1.1,  4 May 1999. 
//
//  Usage: This script should be called in the <body> of an <html> document
//  whose <head> calls the script "Setting e-print archive mirrors, 
//  part 1".  Its purpose is to create a form within the document which
//  can be used to select a new mirror site and store the value in a
//  cookie.  The variable "whichForm" indicates the index value for this
//  from in the document.forms array.  (That is, whichForm=0 if this is the
//  first form which occurs in the document, whichForm=1 if this is the
//  second form, and so on.)  The value of this variable must be set by
//  hand. 
//
//  Submitting the form causes the page to be reloaded; upon reload, the
//  base href will have changed and all relative links within the
//  document will now point to the correct mirror.

var whichForm=0

document.writeln("<FORM NAME='chooseMirror'")
document.writeln("ACTION='"+ document.URL +"'")
document.writeln("onSubmit='return changeMirror(document.forms[" +
  whichForm + "].elements[0].options[document.forms[" + whichForm +
  "].elements[0].selectedIndex].text);'>") 
document.writeln("Download Files from:")
document.writeln("<SELECT NAME='mirror'>")
for (var i = 0; i < mirrorArray.length; i++) {
document.write("<OPTION")
if (goodIndex == i) document.write(" SELECTED")
document.writeln(">" + mirrorArray[i] + "</OPTION>")}
document.write("</SELECT>")
document.writeln("<INPUT TYPE='submit' " +
"VALUE='(Press Here to Confirm a Change of Download Site)'>") 
document.writeln("</FORM>")

// end of script "Setting e-print archive mirrors, part 2" -->

