/*
    Script: image-load.js

    Copyright: Fishnet NewMedia (c) 2003

    Create: 04.01.03

    Version: 1.2

    Compatibility: JavaScript 1.2

    Scripts: image-conf.js

    Changes:
        05.22.03 (SCD) - moved names array out of the script
        05.28.03 (SCD) - create variable for image path

    Description:  

        This script requires the configuration script: image-conf.js

        This script creates a new object (associative array) 
        called "preloads" and creates new properties in the
        preloads object based on each name in the "names"
        array located in the "image-conf.js" file. Each new
        properties' value is set to another property/value
        pair whose property name is set to either "over" or
        "out", and whose value is an image object, created
        by the LoadIMG() function, used to store the preloaded
        image. To preload mouse action images:

           o create two images who filenames are:

             - "NAME-over.gif"
             - "NAME-out.gif"

             where "NAME" is to be replaced with any name you want.

           o add the "NAME" value you chose to the "names" array

        The preloaded application will load both images into the 
        browser's cache.

        To reference the image object, use: preloads[name][action].src

            For example:

            preloads["NAME"]["over"].src
            
        If the images are not in the same folder as this script,
        set the variable "imgpath" in the "image-conf.js" file.

*/

// Create an object literal to be used as an associative 
// array for storing image name/action image objects
var preloads = {};

// Create nested object literals to be used as associative
// arrays for each name defined in the "names" array
for (name in names) preloads[names[name]] = { over: LoadIMG(names[name] + "-over.gif"), out: LoadIMG(names[name] + "-out.gif")};

// Function creates a new image object and returns object to caller
function LoadIMG(filename) {
    var img = new Image();
    img.src = imgpath + filename;
    return img;
}
