// JavaScript routines for sched.php

// Pick up selection of old schedule and redirect page
function old_sched(control)
{
    var rec_id = control.value;
    if (rec_id == "null")
      return;
    location.href = "sched_old.php?termID=" + rec_id;
}

// Pick up selection of even older schedule and redirect page
function older_sched(control)
{
    var page = control.value;
    if (page == "null")
      return;
    window.open(this.href = page);
}

// Function to cause anchor tags with class='new-window' to open in 
//  a new window.
window.onload = function()
{
  var anchors = document.getElementsByTagName('a');

  for (var x = 0; x < anchors.length; x++)
  {
    if (anchors[x].className == 'new-window')
    {
      anchors[x].onclick = function()
      {
        window.open(this.href);
        return false;
      };
    }
  }
};
