/* * * This file preloads the images used in the fade in/out feature AFTER * most of the rest of the page has loaded. This script will be included * LAST in index.php. We call the startSlideShow() function after we * have loaded all slide show images. This script was found and adapted * from: * * http://www.webreference.com/programming/javascript/gr/column3/ * */ // // array of photos // var preload_photo_array = new Array(); preload_photo_array[0] = "images/2006-04-02-05-WhatsThatPlease-450x337.jpg"; preload_photo_array[1] = "images/2006-04-02-09-Whoo-450x337.jpg"; preload_photo_array[2] = "images/2006-04-02-10-HikerTrash-450x337.jpg"; preload_photo_array[3] = "images/2006-06-18-08-AfternoonOnTundra-450x337.jpg"; preload_photo_array[4] = "images/2006-06-18-02-DaveLaughs-450x337.jpg"; preload_photo_array[5] = "images/2006-06-10-07-NahumStyleKing-450x337.jpg"; preload_photo_array[6] = "images/2006-06-10-02-MostOfTheCrew-450x337.jpg"; preload_photo_array[7] = "images/2006-03-25-02-Tracks-450x337.jpg"; preload_photo_array[8] = "images/2006-01-01-ViewFromFirstFlatiron-450x337.jpg"; preload_photo_array[9] = "images/20060624D1-45-RomAndJeniaAscendingUNotch-Sierras.JPG"; preload_photo_array[10] = "images/20060626D2-08-Palisades-Sierras.JPG"; preload_photo_array[11] = "images/20060626D2-43-AJOnSillSummit-Sierras.JPG"; preload_photo_array[12] = "images/20060729D1-58-AJCanyoneering-LowerWolfCreek.JPG"; preload_photo_array[13] = "images/20060811D2-03-Sunset-ZirkelWilderness.JPG"; preload_photo_array[14] = "images/20060825D2-14-GrandCanyonOfTuolumneViews.JPG"; preload_photo_array[15] = "images/20060903D3-49-MikeAndSteveRiverHikingInDinosaurNM-crop.jpg"; preload_photo_array[16] = "images/20060909D1-45-GroupAtDiamondLake.JPG"; preload_photo_array[17] = "images/20060928D2-18-DaveCanyoneering-ZionNP.JPG"; preload_photo_array[18] = "images/20061001D1-47-TedCanyoneering-KolobCreekZionNP-crop.jpg"; preload_photo_array[19] = "images/20061021D1-24-GroupCanyoneeringRoostArea-Utah.JPG"; preload_photo_array[20] = "images/20061022D2-40-GroupCanyoneering-Utah.JPG"; preload_photo_array[21] = "images/20061123D2-58-JonasandChuckCanyoneeringWestPasture-Utah-crop.jpg"; preload_photo_array[22] = "images/IMG_0372.JPG"; preload_photo_array[23] = "images/IMG_0458.JPG"; preload_photo_array[24] = "images/Marmots.jpg"; preload_photo_array[25] = "images/aai.jpg"; preload_photo_array[26] = "images/aba.jpg"; preload_photo_array[27] = "images/abk.jpg"; preload_photo_array[28] = "images/ace_approaching_glass_lake.jpg"; preload_photo_array[29] = "images/acn_sunrise_from_tremont.jpg"; preload_photo_array[30] = "images/acv.jpg"; preload_photo_array[31] = "images/adiBRAINARD_CABIN_MAR6&7.jpg"; preload_photo_array[32] = "images/aek_Valleicto_Valley_in_San_Juans.jpg"; preload_photo_array[33] = "images/afa.jpg"; preload_photo_array[34] = "images/afi.jpg"; preload_photo_array[35] = "images/ahgSTVRAINMTN0718.jpg"; preload_photo_array[36] = "images/ahr_isabelle_glacier.jpg"; preload_photo_array[37] = "images/aik.jpg"; preload_photo_array[38] = "images/aim.jpg"; preload_photo_array[39] = "images/ajc_butterly_on_aster.jpg"; preload_photo_array[40] = "images/ajf_moose_and_two_calves.jpg"; preload_photo_array[41] = "images/akg_Mandy_top_of_Buchanan_Pass.jpg"; preload_photo_array[42] = "images/akn.jpg"; preload_photo_array[43] = "images/amfMONARCH_LAKE_AUG7.jpg"; preload_photo_array[44] = "images/anj.JPG"; preload_photo_array[45] = "images/arf.JPG"; ImagePreloader.prototype.onComplete = function() { this.nProcessed++; if (this.nProcessed == this.nImages) { this.callBack(); } } ImagePreloader.prototype.onload = function() { this.bLoaded = true; // In IE and FireFox and Opera this will be the img element that was just loaded, // in Safari this will be the top level window object. So to work around this // a global reference to the top ImagePreloader object is saved and we'll use that // below instead. if (this.oImagePreloader) { this.oImagePreloader.nLoaded++; this.oImagePreloader.onComplete(); } else { ourIp.nLoaded++; ourIp.onComplete(); } } ImagePreloader.prototype.onerror = function() { this.bError = true; this.oImagePreloader.onComplete(); } ImagePreloader.prototype.onabort = function() { this.bAbort = true; this.oImagePreloader.onComplete(); } ImagePreloader.prototype.preload = function(image) { // create new Image object and add to array var oImage = new Image(); this.aImages.push(oImage); // set up event handlers for the Image object oImage.onload = ImagePreloader.prototype.onload; oImage.onerror = ImagePreloader.prototype.onerror; oImage.onabort = ImagePreloader.prototype.onabort; // assign pointer back to this. oImage.oImagePreloader = this; oImage.bLoaded = false; // assign the .src property of the Image object oImage.src = image; } function ImagePreloader(images, callBack) { // store the callBack this.callBack = callBack; // initialize internal state. this.nLoaded = 0; this.nProcessed = 0; this.aImages = new Array; // record the number of images. this.nImages = images.length; // Save global reference for possible later use! ourIp = this; // for each image, call preload() for (var i = 0; i < images.length; i++) { this.preload(images[i]); } } // end ImagePreloader() function startSlideShow() { slideShow(-1); } // We save a global copy of the ImagePreloader object in case we don't have a reference to it later... var ourIp = null;