/* -------------------------------------------------
/* Created by Sedgwick Richardson
/* Last updated: 23-06-2003
/* By: Mandy
/*
/*----------------------------------------------------------------
/ JPG Viewer scripts
/ Including Back / Forward / Back to index functions
/ Zoom in / out functions
/ Set pulldown menu
/----------------------------------------------------------------*/

//-----------------------------------------------------------------
//Initial variables
//-----------------------------------------------------------------

var maxItem = 138;               // Number of pages
var maxPage = 138;             // Number for displaying in footer
var lastPage = 137;            // Last page of contents
//var maxWidth = 700;         // max allowable width (zoom)
//var minWidth = 100;         // min allowable width (zoom)
//var zoomSize = 40;          // pixels by which image should zoom

//-----------------------------------------------------------------

//This script defines an object called 'Link'
function Link(href,text) {
  this.href = href;
  this.text = text;
}

//This script creates an array called 'myLink'
var item = 0;
var myLink = new Array();

//This script creates a new instance of a 'Link' object
function setLink(href,text) {
  myLink[item] = new Link(href,text);
  item++;
}

//The following parameter 'n' controls the position within the tour
var n=0;

// Function Back
function goBack() {
 //check whether is the single/double page back index
 var backIndex;
 if(check_status())     // double page
  backIndex = maxItem;
 else 
  backIndex = 0;        // single page

  if (n != backIndex) {
    n--;
    self.workarea.location.href = myLink[n].href;
  }
}

// Function forward
function goForward() {
 //check whether is the single/double page forward index
 var forwardIndex;
 if(check_status())      //double page
  forwardIndex = item;
 else 
  forwardIndex = maxItem;     //single page
 
  
  if (n != (forwardIndex - 1)) {
    n++;
    self.workarea.location.href = myLink[n].href;
  }
}

// The following scripts output formatted text, as used
// within the child frames

// Display page numbers
function footer() {
   pageNo = n;
   return 'Page ' + pageNo + ' of ' + (maxItem-1);
}


function get_content_url() {
   return String(self.workarea.location);
}

function check_status() {
   var str_URL = get_content_url();
   var result;
   result = (str_URL.indexOf("_d.htm") == -1) ? false : true;

   return result;
}

// Function Print
function print() {
  open_full('print.htm', 'Print', 560, 550);
}


function open_popup(str_url, str_name, int_width, int_height) {
   var winX = (screen.width - int_width) / 2;
   var winY = (screen.height - int_height) / 2;
   str_WinParams = 'height=' + int_height +',width=' + int_width + ',top=' + winY+',left=' + winX + ',menubar=1,toolbar=0,scrollbars=1,resizable=1,status=1,location=0'; 
   win = window.open(str_url, str_name, str_WinParams);
   if ((parseInt(navigator.appVersion) >= 4)|| (navigator.appName = 'Netscape')) { win.window.focus();     }
}

function open_full(str_url, str_name, int_width, int_height) {
   var winX = (screen.width - int_width) / 2;
   var winY = (screen.height - int_height) / 2;

   var winY_top = winY - 50;
   str_WinParams = 'height=' + int_height +',width=' + int_width + ',top=' + winY_top +',left=' + winX + ',menubar=0,toolbar=0,scrollbars=0,resizable=1,status=0,location=0'; 
   win = window.open(str_url, str_name, str_WinParams);
   if ((parseInt(navigator.appVersion) >= 4)|| (navigator.appName = 'Netscape')) { win.window.focus();     }
}

// Function Download
function download() {
   open_full('download.htm', 'Download', 560, 550);
}
