/*******************************************************************************
FILE NAME    :global.js
DEPENDENCIES :browser.js
********************************************************************************
____________________________ API DOCUMENTATION BEGIN ___________________________
````````````````````````````````````````````````````````````````````````````````
Functions used throughout website.

````````````````````````````````````````````````````````````````````````````````
_____________________________ API DOCUMENTATION END ____________________________
*******************************************************************************/

//-- global variables and functionality begin ----------------------------------
pageLoaded = false; //set page loaded flag
if(top.location.href != self.location.href) top.location.href = self.location.href; //prevent unauthorized framing
//-- global variables and functionality end ------------------------------------

//------------------------------------------------------------------------------
// ROLLOVER FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- preload images
function preloadImage(virtualName, filePath, fileName) {
 eval(virtualName +' = new Image()'); //create a new image object
 eval(virtualName +'.src = "' + filePath + fileName + '"');
}

//FUNCTION-- dynamically swaps one image (also used for rollovers in layers for Netscape 4)
function swapImageSingle(imageName, imageState, imageLayer) {
 if(gBrowser.ns4 && imageLayer!=null) eval('document.' + imageLayer + '.document.images["'+ imageName +'"].src =' + imageName + imageState + ".src"); //path to nested layer for Netscape 4
 else document.images[imageName].src = eval(imageName + imageState + ".src");
}

//FUNCTION-- sets rollover highlight
function setRollover(imageId, imageFilePath, imageFileName) {
 preloadImage(imageId+"_off", imageFilePath, imageFileName);
 preloadImage(imageId+"_on", imageFilePath, imageFileName);
 swapImageSingle(imageId, '_on', null);
}

//FUNCTION-- loads an image on demand
function loadImage(imgObj, filePath, fileName) {
 document.images[imgObj].src = (filePath + fileName);
}

//------------------------------------------------------------------------------
// ROLLOVER FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// NEW BROWSER WINDOW FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- creates a new 3/4 browser window for links to other websites throughout site
function newWin(url) {
 if(url != null || url != "")
 {
  newWin1 = window.open(url,"newview",'directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=yes,width=700,height=350');
  newWin1.focus( );
 }
}

//FUNCTION-- creates a popup window for pdfs
function newPDFWin(url) {
 if(url != null || url != "")
 {
  if(!gBrowser.isMac) 
  {
   pdfWin = window.open(url,"viewPDF",'directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=no,width=700,height=350');
   pdfWin.focus( );
  }
  else window.location.href = url; //mac fix for OS X
 }
}

//------------------------------------------------------------------------------
// NEW BROWSER WINDOW FUNCTIONS END
//------------------------------------------------------------------------------

//---END