//----------------------------------------------------------------------
// tm65.js - formatting, controls and forms for The Magnet 1965
// ver.4.01 - 28 Aug 2003
//----------------------------------------------------------------------

var docNo;
//var sProc   = "tm65_sr03.cgi";
var sProc   = "/cgi-bin/tm65_sr03.cgi";

//var fProc   = "tm65_fr02.cgi";
var fProc   = "/cgi-bin/tm65_fr02.cgi";


//----------------------------------------------------------------------
// Mouseover variables and functions start ...

var nsx;
var nsy;
if (!document.all)
  { document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = get_mouse;
  }

function get_mouse(e)
{ nsx= e.pageX - 10;
  nsy= e.pageY + 5;
}

function layer(id)
{ var res;
  if (document.getElementById)
    { res = document.getElementById(id);
    }
  if (document.all)
    { res = document.all[id];
    }
  if (res)
    { return res.style;
    }
  return null;
}

function fly_in(id)
{ var hlp = layer('Tp' + id);
  if (hlp)
    { if (document.all)
        { nsy = event.y + document.body.scrollTop;
          nsx = event.x + document.body.scrollLeft;
        }
      hlp.top  = nsy + 10;
      hlp.left = (nsx>610 ? nsx-470 : 140);
      hlp.visibility = 'visible';
    }
}

function fly_out(id)
{ var hlp = layer('Tp' + id);
  if (hlp)
    { hlp.visibility = 'hidden';
    }
}

// Mouseover variables and functions end ...
//----------------------------------------------------------------------

// Book Primary Contents Menu ...

var pageN = new Array(5);
pageN[0] = 0;
pageN[1] = 7;
pageN[2] = 23;
pageN[3] = 45;
pageN[4] = 65;
pageN[5] = 83;
pageN[6] = 91;
pageN[7] = 107;
pageN[8] = 141;
pageN[9] = 147;

var sectN = new Array(5);
sectN[0] = "Editorial";
sectN[1] = "Staff";
sectN[2] = "Literary";
sectN[3] = "Grads";
sectN[4] = "Clubs";
sectN[5] = "Social";
sectN[6] = "Sports";
sectN[7] = "Classes";
sectN[8] = "Ads";

// Specific Page References ...
var pageT = new Array(147);
pageT[0]  = "Editorial Section Page";
pageT[1]  = "Endsheet";
pageT[2]  = "Eaton's Reps";
pageT[3]  = "Title Page";
pageT[4]  = "Editorial Staff";
pageT[5]  = "Editorial Page";
pageT[6]  = "Alumni";
pageT[7]  = "Staff Section Page";
pageT[8]  = "Blank Page";
pageT[9]  = "Staff Group Photo";
pageT[10] = "Principal's Message";
pageT[11] = "Vice-Principal's Message";
pageT[12] = "Arrivals - 1";
pageT[13] = "Arrivals - 2";
pageT[14] = "Arrivals - 3";
pageT[15] = "Arrivals - 4";
pageT[16] = "Arrivals - 5";
pageT[17] = "Arrivals - 6";
pageT[18] = "Arrivals - 7";
pageT[19] = "Departures - 1";
pageT[20] = "Departures - 2";
pageT[21] = "Departures - 3";
pageT[22] = "Departures - 4";
pageT[23] = "Literary Section Page";
pageT[24] = "Advertising";
pageT[25] = "Literary - 1";
pageT[26] = "Literary - 2";
pageT[27] = "Literary - 3";
pageT[28] = "Literary - 4";
pageT[29] = "Literary - 5";
pageT[30] = "Literary - 6";
pageT[31] = "Literary - 7";
pageT[32] = "Literary - 8";
pageT[33] = "Literary - 9";
pageT[34] = "Literary - 10";
pageT[35] = "Literary - 11";
pageT[36] = "Literary - 12";
pageT[37] = "Literary - 13";
pageT[38] = "Literary - 14";
pageT[39] = "Literary - 15";
pageT[40] = "Literary - 16";
pageT[41] = "Literary - 17";
pageT[42] = "Literary - 18";
pageT[43] = "Literary - 19";
pageT[44] = "Literary - 20";
pageT[45] = "Grads Section Page";
pageT[46] = "Advertising";
pageT[47] = "Valedictory Address";
pageT[48] = "Annual Commencement";
pageT[49] = "Scholarships and Prizes";
pageT[50] = "Grads - A-B";
pageT[51] = "Grads - B-C";
pageT[52] = "Grads - C-D";
pageT[53] = "Grads - E-H";
pageT[54] = "Grads - H-I";
pageT[55] = "Grads - I-K";
pageT[56] = "Grads - K-L";
pageT[57] = "Grads - L-M";
pageT[58] = "Grads - M-M";
pageT[59] = "Grads - M-P";
pageT[60] = "Grads - P-R";
pageT[61] = "Grads - S-S";
pageT[62] = "Grads - S-W";
pageT[63] = "Grads - W-Y";
pageT[64] = "Grads - No Photo";
pageT[65] = "Clubs Section Page";
pageT[66] = "Advertising";
pageT[67] = "Student Council";
pageT[68] = "Student Council Report";
pageT[69] = "French Club - 1";
pageT[70] = "French Club - 2";
pageT[71] = "Stage Crew";
pageT[72] = "Science Club";
pageT[73] = "World Affairs Club";
pageT[74] = "From Around the School - 1";
pageT[75] = "From Around the School - 2";
pageT[76] = "I.S.C.F";
pageT[77] = "Music & Drama - 1";
pageT[78] = "Music & Drama - 2";
pageT[79] = "Music & Drama - 3";
pageT[80] = "Senior Band - 1";
pageT[81] = "Senior Band - 2";
pageT[82] = "Drama Review";
pageT[83] = "Social Section Page";
pageT[84] = "Advertising";
pageT[85] = "Sock Hops";
pageT[86] = "Autumn Appeal";
pageT[87] = "Snow Palace";
pageT[88] = "Athletic Nights";
pageT[89] = "Jarvis At Home - 1";
pageT[90] = "Jarvis At Home - 2";
pageT[91] = "Sports Section Page";
pageT[92] = "Bantam Football";
pageT[93] = "Senior Football";
pageT[94] = "Junior Football";
pageT[95] = "Gymnastics";
pageT[96] = "Senior Basketball";
pageT[97] = "Hockey";
pageT[98] = "Swim Team";
pageT[99] = "Advertising";
pageT[100] = "Wrestling";
pageT[101] = "Sports Misc.";
pageT[102] = "Girls' Sports - 1";
pageT[103] = "Girls' Sports - 2";
pageT[104] = "Girls' Sports - 3";
pageT[105] = "Girls' Sports - 4";
pageT[106] = "Cheerleaders";
pageT[107] = "Classes Section Page";
pageT[108] = "Advertising";
pageT[109] = "9-A / 9-B";
pageT[110] = "Advertising";
pageT[111] = "9-C / 9-D";
pageT[112] = "Advertising";
pageT[113] = "9-E / 9-F";
pageT[114] = "Advertising";
pageT[115] = "9-G / 9-H";
pageT[116] = "Advertising";
pageT[117] = "9-K / 10-A";
pageT[118] = "Advertising";
pageT[119] = "10-B / 10-C";
pageT[120] = "Advertising";
pageT[121] = "10-D / 10-E";
pageT[122] = "Advertising";
pageT[123] = "10-F / 10-G";
pageT[124] = "Advertising";
pageT[125] = "10-H / 11-A";
pageT[126] = "Advertising";
pageT[127] = "11-B / 11-C";
pageT[128] = "Advertising";
pageT[129] = "11-D / 11-E";
pageT[130] = "Advertising";
pageT[131] = "11-F / 11-G";
pageT[132] = "Advertising";
pageT[133] = "11-H / 12-B";
pageT[134] = "Advertising";
pageT[135] = "12-A / 12-C";
pageT[136] = "Advertising";
pageT[137] = "12-D / 12-E";
pageT[138] = "Advertising";
pageT[139] = "12-F";
pageT[140] = "Advertising";
pageT[141] = "Ads Section Page";
pageT[142] = "Advertising";
pageT[143] = "Advertising";
pageT[144] = "Not so long ago";
pageT[145] = "Camera Club";
pageT[146] = "Simpson's Reps";

function dropHdr()
{ // Standard preamble for subsidiary page ...
  document.write("<center><table width=550 border=0 cellpadding=0 cellspacing=0>");
  document.write("<tr><td valign=top width=130><a href=\"index.html\">");
  document.write("<img src=\"images/logo02.gif\" align=left hspace=0 vspace=0 border=0>");
  document.write("</a></td><td valign=top>");
  document.write("<img src=\"images/pixel.gif\" alt=\"Spacing\" height=15 width=400><br>");
  document.write("<font color=999999>An electronic reproduction of</font>");
  document.write(" <b>The Magnet 1963-1965</b>");
  document.write("<br><img src=\"images/hBar01.gif\" alt=\"Separator\"  height=1 width=400 vspace=4><br>");
  dropSiteMenu();
  document.write("</td></tr><tr><td colspan=2>");
  document.write("<img src=\"images/hBar01.gif\" alt=\"Separator\" height=1 width=531 vspace=3><br>");

  // Skip internal navigation materials for non-book documents ...
  tstType = new String(docNo);
  var docType = tstType.substring(0, 4);
  if (docType != "page")
     return;

  // Frame the navigation materials ...
  document.write("<table width=530 cellpadding=0 cellspacing=0 border=0>");
  document.write("<tr><td align=left nowrap>");

  // Construct hierarchical indication of document location ...
  document.write("<a href=\"index.html\">Home</a>");
  document.write(" <img src=\"images/pconnect.gif\" border=0> ");
  var pageNum = tstType.substring(4) * 1;
  var idx;
  for (idx = 1; idx < 10; idx++)
    { var limPage = pageN[idx] * 1;
      if (pageNum < limPage)
        { idx--;
          break;
        }
    }
  document.write("<a href=\"page" + pageN[idx] + ".html\">" + sectN[idx] + "</a>");
  document.write(" <img src=\"images/pconnect.gif\" border=0> ");
  var pageRef = tstType.substring(4) * 1;
  document.write("<b>" + pageT[pageRef] + "</b> &nbsp;[Page " + pageRef + "]");

  // Construct page scrolling navigation ...
  document.write("</td><td align=right nowrap>");
  var wkPageN;
  var wkPageL;
  if (pageNum > 0)
    { wkPageN = pageNum - 1;
      wkPageL = "page" + wkPageN;
      document.write("<a href=\"" + wkPageL +".html\">");
      document.write("<img src=\"images/dirbutleft.gif\" hspace=2 border=0 ");
      document.write("alt=\"Page " + wkPageN + "\" ");
      document.write("onMouseOver=\"src=&quot;images/dirbutleftx.gif&quot;;\" ");
      document.write("onMouseOut=\"src=&quot;images/dirbutleft.gif&quot;;\"></a> ");
      document.write("<a href=\"" + wkPageL + ".html\">Page" + wkPageN + "</a>");
    }
  else
    { document.write("<img src=\"images/pixel.gif\" height=2 width=59> ");
    }

  document.write(" &nbsp; &nbsp;");

  if (pageNum < 146)
    { wkPageN = pageNum + 1;
      wkPageL = "page" + wkPageN;
      document.write("<a href=\"" + wkPageL + ".html\">Page" + wkPageN + "</a>");
      document.write(" <a href=\"" + wkPageL +".html\">");
      document.write("<img src=\"images/dirbutright.gif\" hspace=2 border=0 ");
      document.write("alt=\"Page " + wkPageN + "\" ");
      document.write("onMouseOver=\"src=&quot;images/dirbutrightx.gif&quot;;\" ");
      document.write("onMouseOut=\"src=&quot;images/dirbutright.gif&quot;;\"></a> ");
    }
  else
    { document.write("<img src=\"images/pixel.gif\" height=2 width=55> ");
    }

  document.write("</td></tr></table>");
  document.write("<img src=\"images/hBar01.gif\" alt=\"Separator\" height=1 width=531 vspace=2><br>");
//  document.write("<font size=2 face=\"Verdana, Arial, Geneva, Helvetica\" color=000000>");
}


function dropFooter(endCode)
{ // Common footer code ....
  if (endCode)
    document.write(endCode);
  document.write("</td></tr><tr><td colspan=3>");
  document.write("<img src=\"images/hBar01.gif\" alt=\"Separator\" height=1 width=");
  if (docNo == "index")
    document.write("600");
  else
    document.write("530");
  document.write(" vspace=2>");
  document.write("</td></tr></table></body></html>");
}

//----------------------------------------------------------------------------
// Obfuscated email link ...
//----------------------------------------------------------------------------
function makeMailto(eTarg)
{ var sendTo = 'mailto:' + eTarg + '&#064;' + 'magnet65.org';
  document.write('<a href=\"' + sendTo + '\"><b>' + eTarg + '&#064;magnet65.org</b></a>');
}



function dropSiteMenu()
{ // Site Global Menu ...
  var nPage = docNo;
  var docN = new Array(5);
  docN[0] = "index";
  docN[1] = "det0010";
  docN[2] = "det0101";
  docN[3] = "det0250";
  var litN = new Array(5);
  litN[0] = "Home";
  litN[1] = "Search";
  litN[2] = "Help";
  litN[3] = "Webmaster";

  for (var i = 0; i < 4; i++)
    { if (nPage == docN[i])
         continue;
      document.write("<a href=\"" + docN[i] + ".html\">" + litN[i] + "</a>");
      document.write(" &nbsp; &nbsp; ");
    }
}

function putTime()
{ d = new Date();
  document.write(d.toLocaleString());
}

function jumpPage(pgNo)
{ if (isNaN(pgNo))
    { alert("Page number " + pgNo + " is not valid.  \nTry again.");
      return false;
    }
  var pNo = pgNo * 1;
  if (pNo < 0 || pNo > 146)
    { alert("There is no page " + pNo + " in The Magnet 1965.  \nTry again.");
      return false;
    }
  var wkLoc = "page" + pNo + ".html";
  document.goTo.action = wkLoc;
  document.location = wkLoc;
  return true;
}

function validateForm(fType)
{ var eTest;
  if (document.eForm1.fType.value != "SendLink")
    { var eTest = document.eForm1.cName.value;
      if (eTest == "")
       { alert("Please provide your name.   \nThank you.");
         return false;
       }
    }
  eTest = document.eForm1.sender.value;
  if (eTest == "")
    { alert("Please provide your email address.   \nThank you.");
      return false;
    }
  tstStr = new String(eTest);
  if (tstStr.indexOf("@") == -1 ||
      tstStr.indexOf(".") == -1 )
    { alert("Invalid format for your email address.   \nPlease re-enter. Thank you.");
      return false;
    }
  if (document.eForm1.fType.value == "SendLink")
    { eTest = document.eForm1.sendTo.value;
      if (eTest == "")
        { alert("Please provide the Send To email address.   \nThank you.");
          return false;
        }
      tstStr = new String(eTest);
      if (tstStr.indexOf("@") == -1 ||
          tstStr.indexOf(".") == -1 )
        { alert("Invalid format for Send To email address.   \nPlease re-enter. Thank you.");
          return false;
        }
    }
  if (document.eForm1.fType.value == "Contact")
    { if (document.eForm1.mText.value == "")
       { alert("Your message appears to be blank!  \nPlease retry. Thank you.    ");
         return false;
       }
    }
  return true;
}

function validateSForm()
{ var eTest;
  if (document.sform1.args.value == "")
    { alert("Please enter something to search for.   \nThank you.");
      return false;
    }
}

function sForm()
{ document.write("<form name=sform1 action=\"" + sProc + "\" method=get ");
  document.write("onSubmit=\"return validateSForm();\">");
  document.write("<img src=\"images/pixel.gif\" align=left width=47>");
  document.write("<a href=\"tm65_sr03.log\"><img src=\"images/logo03.gif\" align=middle hspace=15 border=0 alt=\"Search Log\"></a>");
  document.write("<input type=text name=args size=25 ");
  document.write("style=\"width:225px;height:20px;font-size:11px;color=333333;background=FFFFFF;font-family=Sans-Serif\"> ");
  document.write("<input type=hidden value=23 name=reqKey>");
  document.write("<input type=submit value=\"Site Search\" ");
  document.write("style=\"width:85px;height:21px;font-size:11px;color=333333;background=CECECE;font-family=Sans-Serif\"> ");
  document.write("</form>");
}

function makeField(fType, fName, fLiteral)
{ document.write("<tr><td align=right valign=top nowrap>");
  document.write(fLiteral + " &nbsp;");
  document.write("</td><td align=left valign=top nowrap>");
  if (fType == "text")
    { document.write("<input type=text name=" + fName);
      document.write(" style=\"width:225px;height:20px;font-size:10px;\"");
      document.write(">");
    }
  else if (fType == "textarea")
    { document.write("<textarea name=" + fName + " xcols=25 xrows=3 ");
      document.write("style=\"width:225px;height:65px;font-size:11px;\"");
      document.write("></textarea>");
    }
  document.write("</td></tr>");
}

function tm65_fr02(fType, butText)
{ document.write("<br><br><img src=\"images/pixel.gif\" align=left width=10 height=20>");
  document.write("<form name=eForm1 action=\"" + fProc + "\" ");
  document.write("method=post onSubmit=\"return validateForm();\">");
  document.write("<input type=hidden name=fType value=" + fType + ">");
  document.write("<input type=hidden value=23 name=reqKey>");
  document.write("<table border=0 cellpadding=0 cellspacing=0>");
  if (fType == "Contact" || fType == "Group")
    { makeField("text",     "cName",  "Your name");
      makeField("text",     "sender", "Your email address");
      makeField("textarea", "mText",  "Your message");
    }
  else if (fType == "Register")
    { makeField("text",     "cName",  "Your current name");
      makeField("text",     "oName",  "Your name in 1965");
      makeField("text",     "sender", "Your email address");
      makeField("textarea", "mText",  "Comments");
    }
  else if (fType == "SendLink")
    { makeField("text",     "sender", "Your email address");
      makeField("text",     "sendTo", "Send to email address");
      makeField("textarea", "mText",  "Message (optional)");
    }
  document.write("<tr><td align=right valign=top nowrap colspan=2>");
  document.write("<input type=submit value=\"" + butText + "\" ");
  document.write("style=\"width:55px;height:21px;font-size:11px;\"");
  document.write("></td></tr></table></form></td></tr></table>");
}


//----------------------------------------------------------------------------
// Perform standard document initialization ...
// This is not used for the index page [with effect version 2.1]
//----------------------------------------------------------------------------
  document.write("<body bgcolor=FFFFFF text=000000 link=333333 vlink=333333><center>");

  tstUrl = new String(document.location);
  var tLoc1 = tstUrl.lastIndexOf("/");
  var tLoc2 = tstUrl.indexOf(".html");
  docNo     = tstUrl.substring(tLoc1 + 1, tLoc2);

  document.write("<style type=\"text/css\"><!--");
  document.write("body,td,div,.p,a{font-family:Verdana, Arial, Helvetica, Sans-Serif;font-size: 8pt }");
  document.write("div,td{color:#000000}");
  document.write(".f,.fl:link{color:#6f6f6f}");
  document.write("a:link,.w,a.w:link,.w a:link{color:#999999;font-weight:bold;text-decoration: none;}");
  document.write("a:visited,.fl:visited{color:#999999;font-weight:bold;text-decoration: none;}");
  document.write("a:active,.fl:active{color:#999999;font-weight:bold;text-decoration: none;}");
  document.write("a:hover,.fl:hover{color:#000000;font-weight:bold;text-decoration: none;}");
  document.write("SPAN.hint {border-right: #666666 1px solid;padding-right: 10px;border-top: #AAAAAA 1px solid;padding-left: 10px;font-weight: normal;left: 0px;visibility: hidden;padding-bottom: 10px;text-transform: none;border-left: #AAAAAA 1px solid;width: 400px;color: 000000;padding-top: 5px;border-bottom: #666666 1px solid;font-style: normal;position: absolute;top: 0px;background-color:FFFFFF;font-variant: normal;text-decoration: none;}");
  document.write("//-->");
  document.write("</style>");

  dropHdr();


