﻿// The following code caches images that are not already loaded in 
// the HTML document (ones that do not exist in an IMG tag).
//
// It is not required to cache images that will be used for your mouseovers.
// However, if images are not cached, you run a risk of having long delays
// before the mouseover images show up.
//
// If you decide not to cache images, omit this block of code and skip down
// to the "swapImage" function

var cacheDone;

if (document.images) {
	if (cacheDone != true) {	// make sure this code only runs once
		// repeat the following two lines of code for each image you 
		// will use that is not already shown on the page.
		// change the number "1" after "image" on both lines so that the 
		// variable name for each cached image is numbered different

		image1 = new Image();
		image1.src = "media/nav_contact_m.gif";
	    image2 = new Image();
		image2.src = "media/nav_film_m.gif";
		image3 = new Image();
		image3.src = "media/nav_obtaindvd_m.gif";
      	image4 = new Image();
		image4.src = "media/nav_ourbrazil_m.gif";
		
       
        cacheDone = true;	// do not change this line
	}
}

// Here is the swapImage function.
//
// this function takes two paramaters.  The first is the name
// of the image.  This is not the name of the image file, but
// the name that is given to the IMG tag (see example below)
// <IMG SRC="iamges/image.gif" NAME="menu_item">
// The name of this example image is menu_item.  The name should
// countain only alphanumeric charecters and underscores and 
// should not start with a number.
//
// The second parameter is the image file that will replace the
// image on the page.  The relative path information must be
// included just as it would be in the image tag.
// 
// To change the image in the above example to an image called
// image2.gif which is also in the images folder, the function
// call would be like this:
// swapImage('menu_item', 'images/image2.gif')

function swapImage (imageName, imagePathAndFileName) {
	if (document.images) {
		eval ('document.images.' + imageName + '.src = "' + imagePathAndFileName + '"');
	}
}
