// Declare & initialize global reply objects:
var max_faq = 9;
d_image = new Object( );

// The following function assigns the correct image to display.
function assgn_img(name) {
    if (document.images) {                        // Check if browser supports DOM
      d_image.pic = "IMAGES/PHOTOS/" + name + ".JPG";
    }
}

// The following function assigns the correct image to display.
function assgn_img2(name,dir) {
    if (document.images) {                        // Check if browser supports DOM
      d_image.pic = "IMAGES/STARSTDT/" + dir + "/" + name + ".JPG";
    }
}

// The following function assigns the correct image to display.
function assgn_img3(name,dir) {
    if (document.images) {                        // Check if browser supports DOM
      d_image.pic = "IMAGES/PHOTOS/" + dir + "/" + name + ".JPG";
    }
}

// The following function will dynamically change images on mouseover.
// variable "level" = how many levels down from the top directory level
// variable "id" = name of the image to be changed
// variable "act" = action to be taken
function activeimage(level,id,act) {
    if (document.images) {                        // Check if browser supports DOM
      var down = "" ;                             // Initialize loop variables
      var count = 0 ;
      while (count < level) {                     // Determine how many levels down
        down += "../";
        count += 1;
      }
      switch (act) {
        case 'ov':                                // Mouseover Image
          document.images[id].src = down + "IMAGES/DINGBATS/OVER/" + id + ".JPG";
          break;
        case 'ns':                                // Non-selected Image
          document.images[id].src = down + "IMAGES/DINGBATS/UNSEL/" + id + ".JPG";
          break;
        case 'sel':                               // Selected Image
          document.images[id].src = down + "IMAGES/DINGBATS/SEL/" + id + ".JPG";
          break;
        default:
          break;                                  // Default is to do nothing
        }                                         // Close switch statement
    }                                             // Close "if (document.images)" statement
}                                                 // Close function "activeimage"

// This function sequentially cycles the image at the image at the top of the page.
// variable "level" = how many levels down from the top directory level
// variable "img" = number of image to display
function cycler(level,img) {
    var MAX_NUM = 5                                          // Number of images to be cycled
    if (document.images)  {                                  // Check if browser supports DOM
      var count = 0 ;                                        // Initialize loop variables
      var down = "" ;                             
      while (count < level) {                                // Determine how many levels down
        down += "../";
        count += 1;
      }
      var images = new Array(MAX_NUM);                       // Create dummy array
      for (i=0; i<MAX_NUM; i++) {                            // Force images to be cached
        images[i] = new Image( );                            // Create an image object
        images[i].src = down + "IMAGES/REVOLVE/T" + i + ".JPG";
      }
      if (img > MAX_NUM) {                                   // If beyond max # of images, reset
        img = 1;
      }
      var pic = "REVOLVE";                                   // Name of image in DOM we want to cycle
      var path = down + "IMAGES/REVOLVE/T" + img + ".JPG";   // Assign image path
      document.images[pic].src = path;                       // Assign new image
      img += 1;                                              // Increment to next image
      var loop = "cycler(" + level + "," + img + ")";        // Function needs to call itself again
      setTimeout (loop, 4000);                               // Call itself again in 10 seconds
    }                                                        // Close "if (document.images)" statement
}                                                            // Close function "cycler"

// This function allows you to open a controlled window.  
// Various display options are available.
// First Created: 02-MAR-2000
// Last Modified: 02-MAR-2000
// file = File path to be opened
// win = Name of window to be opened
// opt = Display option selected
function open_win(file,win,opt) {
    if (opt == 0) {                    // Standard window display
      window.open(file,win);
    }
    if (opt == 1) {                    // Restricted display #1 with menubar
      window.open(file,win,'width=700,height=400,status=yes,resizable=yes,scrollbars=yes,menubar=yes');
    }
    if (opt == 2) {                    // Restricted display #2 with menubar
      window.open(file,win,'width=700,height=500,status=yes,resizable=yes,scrollbars=yes,menubar=yes');
    }
    if (opt == 3) {                    // Restricted display #3 with menubar
      window.open(file,win,'width=700,height=600,status=yes,resizable=yes,scrollbars=yes,menubar=yes');
    }
    if (opt == 4) {                    // Restricted display with no menubar
      window.open(file,win,'width=700,height=500,status=yes,resizable=yes,scrollbars=yes');
    }
    else {                             // Default in case of bad input
      window.open(file,win);
    }
}

// This function works-around a support issue for the "window.print" method
// First Created: 02-MAR-2000
// Last Modified: 02-MAR-2000
function print_win( ) {
    if (window.print) {
      window.print( );
    }
    else {
      msg = "Unfortunately, your browser does not support this\n"
      msg += "feature.  Please use the menubar instead.  Click\n"
      msg += "on 'File' and then select the 'Print...' option."
      alert(msg);
    }
}

function prev_faq(numb) {
    var win_info = "width=660,height=500,status=yes,resizable=yes,scrollbars=yes,menubar=yes";
    if (numb==1) {
      msg = "This is the first FAQ!";
      alert(msg);
    }
    else {
      prev_numb = numb-1;
      file = "faq" + prev_numb + ".html";
      window.open(file,'FAQWIN',win_info);
    }
}

function next_faq(numb) {
    var win_info = "width=660,height=500,status=yes,resizable=yes,scrollbars=yes,menubar=yes";
    if (numb>=max_faq) {
      msg = "This is the last FAQ!";
      alert(msg);
    }
    else {
      next_numb = numb+1;
      file = "faq" + next_numb + ".html";
      window.open(file,'FAQWIN',win_info);
    }
}

