// This file contains functions that are common to several pages on the
//   the Ruffe Web Page

var pathbutt = "gnrl/buttons/";

//----------------------------------------------------------------------------
//this method renames the original window to orgName so that the remote
//  window name newName can refer back to the original.  Thus the remote
//  window can serve as a menu or remote for the original window.

//I have implemented this feature by making all windows opened with it without
//  a status bar, toolbar, location bar, or menu but they have scrollbars and 
//  can be resized.  In addition, I have the function receive a percentage
//  from the calling routine that will dictate what size the window will be
//  based on the resolution of the users screen.
function launch(newURL, newName, winsize, orgName) {
  newFeatures = "status=no,toolbar=no,location=no,menu=no"
  newFeatures += ",scrollbars=yes,resizable=yes"
  //set the height and width of the window according to the size of the
  //  users screen if the user is using version 4 or greater (otherwise set)
  if (parseFloat(navigator.appVersion) >= 4) {
    newFeatures += ",width=" + (winsize*screen.width);
    newFeatures += ",height=" + (winsize*screen.height);
    //Set the location of the new window -- uses different code depending on
	//  the type of browser -- so check for it
    locval = (1-winsize)/2;
    if (navigator.appName.indexOf("Microsoft")>=0)  {
      newFeatures += ",left=" + (locval*screen.width)
      newFeatures += ",top=" + (locval*screen.height)
     } else {
      newFeatures += ",screenX=" + (locval*screen.width)
	  newFeatures += ",screenY=" + (locval*screen.height)
    }
   } else {
    newFeatures += ",width=300, height=300"
  }
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)   //in case something went wrong during the open
    remote.opener = window;
//Names the original window with orgName (remote is the new window, the opener
//  object contains the window that it was opened from
  remote.opener.name = orgName;
  return remote;
}

//----------------------------------------------------------------------------
// image changes on onMouseOver
// (c) 1996 Michael Moncur - http://starlingtech.com/books/javascript/
// freeware - copy if you want to

// global variables (one per image to store highlighted version)
// (these are not used again, since the image is cached.)
var img1 = new Image();	var img2 = new Image();	var img3 = new Image();
var img4 = new Image();	var img5 = new Image();	var img6 = new Image();

function highlight(back2gnrl,img) {  //* highlight a link
	document[img].src = back2gnrl + pathbutt + img + "_D.GIF";
}

function unhighlight(back2gnrl,img) {  //* un-highlight a link
	document[img].src = back2gnrl + pathbutt + img + "_U.GIF";
}

//----------------------------------------------------------------------------
//Gather information about what hardware the user is reading the page with.
function browserinfo () {
//Putting browser info into global variables that can be accessed by all
//  other scripts on a page where this library is loaded.
var browserName = navigator.appName
var browserVersion = navigator.appVersion
var browserVersionNum = parseFloat(browserVersion)
var codeName=navigator.appCodeName
var userAgent=navigator.userAgent
var agt=navigator.userAgent

//-- Get platform information and store in yourOS.
var yourOS="unknown"
if ((agt.indexOf("Win95")!=-1)||(agt.indexOf("Windows 95")!=-1)) 
   {yourOS='Windows 95'}
if ((agt.indexOf("Win98")!=-1)||(agt.indexOf("Windows 98")!=-1))
   {yourOS='Windows 98'}
if ((agt.indexOf("WinNT")!=-1)||(agt.indexOf("Windows NT")!=-1))
   {yourOS='Windows NT'}
if ((agt.indexOf("Win16")!=-1)||(agt.indexOf("Windows 3.1")!=-1))
   {yourOS='Windows 3.<i>x</i>'}
if (agt.indexOf("Macintosh")!=-1) {
   if (agt.indexOf("PC)")!=-1) {yourOS='Mac PPC'} else {yourOS='Mac 68K'}
}
if (agt.indexOf("SunOS")!=-1) {yourOS='Unix Sun'}
if (agt.indexOf("IRIX")!=-1) {yourOS='Unix SGI'}
if (agt.indexOf("HP-UX")!=-1) {yourOS='Unix HP'}
if (agt.indexOf("AIX")!=-1) {yourOS='Unix IBM'; }

//-- Assign initial values for browser settings to global variables.
var availheight="unknown"
var availwidth="unknown"
var bufferdepth="unknown"
var colordepth="unknown"
var height="unknown"
var width="unknown"
var javaOK = "unknown"
var cookiesOK = "unknown"
var minorVers = "unknown"
var cpu = "unknown"
var browsLang = "unknown"

//-- If browser is version 4 or better we can take a deeper look.
if (browserVersionNum >= 4) {
  var availheight=screen.availHeight
  var availwidth=screen.availWidth
  var colordepth=screen.colorDepth + " bit"
  var height=screen.height
  var width=screen.width
  if (navigator.javaEnabled()==true){javaOK="Yes"}else{javaOK="No"}
  //-- cookieEnabled only works in MSIE.
  if (browserName=="Microsoft Internet Explorer") {
    if (navigator.cookieEnabled==true) {
      cookiesOK="Yes"
    }else{
      cookiesOK="No"
    }
  }
  //-- These all end up as unknowns in Navigator 4.05.
  var minorVers = navigator.appMinorVersion
  var cpu = navigator.cpuClass
  var browsLang = navigator.browserLanguage 
}
}

//----------------------------------------------------------------------------
//Returns date this page was last modified (without the annoying time)
function lastModified() {
   var modiDate=new Date(document.lastModified)
   var showAs=modiDate.getMonth()+1+"/"+modiDate.getDate()
   showAs+="/"+modiDate.getYear() 
   return showAs
}
