function popUpWindow(linkURL, windowName, windowTitle, windowWidth, windowHeight) {
	// The following code snippet provides the pop-up window functionality for external links.  The basic idea is that the function opens a smaller window (without address bar) and then turns the focus onto it.  By default it's meant for opening up pop-ups of images, but if you set windowTitle to "noImage", then it will open up the pop-up using the linkURL.  IF you want the <a> link to disply in the href attribute, make sure to use the onClick function to call this function and then call "return false;" (that will prevent the href link from working in javascript-enabled browsers).
	// The general format to call this function in an HTML page is: <a href="URL" onclick="popUpWindow(this, 'windowName', 'windowTitle', 'windowWidth', 'windowHeight'); return false;">TEXT-OR-IMAGE</a>
	
	var popUpWin = window.open(unescape(linkURL), windowName, "menubar,resizable,scrollbars,width=" + windowWidth + ",height=" + windowHeight);
	popUpWin.focus();
	return false; 
}
function playMovie(movieName,otherMovieNames,noMovieSwitch) {
	// This function simply changes which embedded movie player is visible so that it appears that you are switching movie bandwidths.  I could not determine a way to JavaScript-control the source of an embedded player.  The last parameter, "noMovieSwitch" has been added to allow you to use this function to simply switch visibilities of different div containers (and not play anything).  In order to use this function, all div id's that you want to be visible/invisible MUST begin with the name "div", and the remainder of the div id must be used in the movieName and otherMovieNames variables (comma-separated list).
	var otherMoviesArray = otherMovieNames.split(",");
	// declare a few variables
	var layerRef = "";
	var styleSwitch = "";
	var what = "none";
	// Make this pretty wide browser-compatible by assigning variables to the right values for switching visibility
	 if (document.layers) { 
		 // Netscape 4 compatibility
		 layerRef="document.layers"; 
		 styleSwitch="";
		 what = "ns4";
	 } else if(document.getElementById) { 
		 // Modern browsers compatibility
		 layerRef="document.getElementByID"; 
		 styleSwitch=".style"; 
		 what="dom1"; 
	 } else if(document.all) { 
		 // IE 4 compatibility
		 layerRef="document.all"; 
		 styleSwitch=".style"; 
		 what ="ie4"; 
	 } 
	// If we have problems, get out.
	if (what == "none") {
		return;
	}
	// Otherwise, stop and hide the other movies (if they and their layers exist).  We'll use the "noMovieSwitch" to determine whether to stop the movies (noMovieSwitch shouldn't equal "noMovie")
	for (var i=0; i < otherMoviesArray.length; i++) {
		if (what == "dom1") {
			// Of course, you only want to make movies stopped and layers inivisble for movies and layers that exist....
			if ((noMovieSwitch != 'noMovie') && (typeof(document[otherMoviesArray[i]]) != undefined) && (typeof(document[otherMoviesArray[i]]) != "undefined")) {
				document[otherMoviesArray[i]].Stop();
				document[otherMoviesArray[i]].Rewind();
			}
			if (document.getElementById('div' + otherMoviesArray[i]) != null)  {
				document.getElementById('div' + otherMoviesArray[i]).style.visibility = 'hidden';
			}
		} else {
			// Of course, you only want to make movies stopped and layers inivisble for movies and layers that exist....
			if ((noMovieSwitch != 'noMovie') && (typeof(eval(layerRef + '[\"' + otherMoviewsArray[i] +'\"]')) == "function")) {
				eval(layerRef + '["' + otherMoviewsArray[i] + '"].Stop()');
			}
			if (typeof(eval(layerRef + '["div' + movieName +'"]')) == "object")  {
				eval(layerRef + '["div' + otherMoviewsArray[i] +'"]' + styleSwitch + '.visibility = "hidden"');
			}
		}
	}
	//.., and show and play the selected movie. We'll use the "noMovieSwitch" to determine whether to play the movie (noMovieSwitch shouldn't equal "noMovie")
	if (what == "dom1") {
		if (document.getElementById('div' + movieName) != null)  {
			document.getElementById('div' + movieName).style.visibility = 'visible';
		}
		if ((noMovieSwitch != 'noMovie') && (typeof(document[movieName]) != undefined)) {
			document[movieName].Play();
		}
	} else {
		if (typeof(eval(layerRef + '["div' + movieName +'"]')) == "object")  {
			eval(layerRef + '["div' + movieName +'"]' + styleSwitch + '.visibility = "visible"');
		}
		if ((noMovieSwitch != 'noMovie') && (typeof(eval(layerRef + '[\"' + movieName +'\"]')) == "function")) {
			eval(layerRef + '["' + movieName +'"].Play()'); 
		}
	}
}
function pickRandom(range) {
	/* A random number/image generation function */
	if (Math.random) {
		return Math.round(Math.random() * (range-1));
	} else {
		var now = new Date();
		return (now.getTime() / 1000) % range;
	}
}
function generateRandomImage(imageArray) {
	/* This function actually generates the HTML for the random images on the gateway home page.  The function takes a single parameter: the name of the desired imageArray.  The various imageArrays themselves are generated by the CMS for each page and contains all the relevant information.  This function also calls on the pickRandom function (above) to call a random member of the imageArray */
	// First define all the image variables to be used in this function (source, alt text, etc.).
	var imageSource = "";
	// var imageWidth = 0;
	// var imageHeight = 0;
	var imageBorder = 0;
	var imageAltText = "";
	var imageCaptionHTML = "";
	
	// Now figure out a random member of the passed-in imageArray.
	var imageArrayIdentifier = imageArray[pickRandom(imageArray.length)];
	// Now generate the components of the HTML to be written, and write it out!
		imageSource = imageArrayIdentifier["src"];
		if (imageArrayIdentifier["description"].length > 0) {
			imageAltText = imageArrayIdentifier["description"];
			imageCaptionHTML = "\n<span>" + imageArrayIdentifier["description"] + "</span>";
		} else {
			imageAltText = "No description available for this image"; 
		}
		
	// For everything else, do nothing.  This will get caught in the next if routine, which detects whether there's any code in imageSource.
	if (imageSource != "") {
		document.write('<img src="' + imageSource + '" alt="' + imageAltText + '" />' + imageCaptionHTML);
		document.close();
	}
}
function generateRandomImages(imageArray,multipleImageIndicator) {
	/* This function is quite similar to the generateRandomImage function above, but is more intended for displaying multiple images inline.  It's different enough that it seemed easier and wiser to duplicate many ofthe above function's features in a new function rather than trying to retrofit this into the original function. The function takes two parameters: the name of the desired imageArray, and the maximum number of images to display.  The imageArray itself is generated by the CMS for each page that uses this function, and the array contains all the relevant information.  This function also calls on the pickRandom function (above) to call a random member of the imageArray.  The tricky part about this function is that we need multiple, non-repeating random images to display, requiring a departure from the standard single pickRandom function call. 
	// WHEN USING THE multipleImageIndicator, MAKE SURE THE imageArray HAS AT LEAST AS MANY MEMBERS AS the value of multipleImageIndicator!!!
	*/
	
	// First create the randomImage array, which will contain the required member identifier(s) for the imageArray.
	var randomImage = new Array();
	// First determine whether we're dealing with one or many images
	// For multiple random images, we need to do something more complicated than with single random images.  Basically, we need to ensure that each of the values that will be pushed into the randomImage array are unique, since these numbers correspond to the imageArray image members that will be displayed side-by-side.  (We certainly don't want two of the same image on a page!)  Since JavaScript's array deletion is pretty primitive and poses problems for accessing "deleted" array members (preventing a bubble-sort-like method), the easiest solution is to randomly shuffle the temporary array's members and pick the first "n" members from the shuffled array using the multipleImageIndicator as "n" (the members' values will be used to pick the imageArray members).  We can assure no duplicates!
	var temporaryArray = new Array();
	// Now populate the temporaryArray with a sequence that corresponds to the indexes of the imageArray (basically, 0 to the count of imageArray)
	for (var i = 0; i < imageArray.length; i++) {
		temporaryArray[i] = i;
	}
	// Now shuffle the temporaryArray members, (this was taken from a cards shuffling example at <http://www.brainjar.com/js/cards/default2.asp>
	var randomNumber = 0; // This is just a variable that will hold randomly-generated numbers in the for loop below.
	var numberPlaceholder = 0; // This is a placeholder for the shuffle routine (it holds an array member's value while that member's value is being replaced by another random array member's value
	for (var j = 0; j < temporaryArray.length; j++) {
		randomNumber = pickRandom(temporaryArray.length); // Generate the random number
		numberPlaceholder = temporaryArray[j]; // Push the value of the current temporaryArray member into the numberPlaceholder
		temporaryArray[j] = temporaryArray[randomNumber]; // Replace the current array member's value with the value from the randomNumber array member
		temporaryArray[randomNumber] = numberPlaceholder; // Finish the shuffle step by replacing the randomNumber array member's value with the numberPlaceholder's value. 
	}
	// Now pick a random starting point (at least multipleImageIndicator number of members away from the end), and pick the next multipleImageIndicator number of members from the shuffled array.
	var randomStartingPoint = pickRandom(temporaryArray.length - Number(multipleImageIndicator));
	// And now fill in randomImage with the appropriate multipleImageIndicator number of values from temporaryArray, using randomStartingPoint as the starting point..
	for (var k = 0; k < multipleImageIndicator; k++) {
		randomImage[k] = temporaryArray[randomStartingPoint + k];
	}
	// Now we need to loop through randomImage and generate the right HTML for each image that the randomImage member is pointing to in imageArray.
	var htmlCode = "";
	for (imageIndex in randomImage) {
		var imageChoice = randomImage[imageIndex];
		htmlCode += '<a href="' + imageArray[imageChoice]["link"] + '"><img src="' + imageArray[imageChoice]["src"] + '" alt="' + imageArray[imageChoice]["description"] + '" /></a> ';
	}
	// Lastly, we want to write out the code to the document.
	document.write(htmlCode);
	document.close();
}
function generateRandomFeature(featureArray) {
	/* This function generates the HTML for the random feature highlight on various site pages.  The function takes a single parameter: the name of the desired featureArray.  The various featureArrays themselves are generated by the CMS for each page and contains all the relevant information for the feature highlight.  This function also calls on the pickRandom function (above) to call a random member of the featureArray */
	// First define all the variables to be used in this function (header, name, source, alt text, etc.).
	var featureHref = "";
	var thumbnailImageWidth = 90; // This is hard-coded
	var thumbnailImageHeight = 90; // This is hard-coded
	var thumbnailImageBorder = 0;
	var featureListString = "";
	var indexPageString = "";
	var outputHTML = "";
	
	// Now figure out a random member of the passed-in featureArray.
	var featureArrayIdentifier = featureArray[pickRandom(featureArray.length)];
	// Now generate the components of the HTML to be written, and write it out!
	featureHref = featureArrayIdentifier["src"];
	// start with the title (removed title and replaced with name/position for now)
	// if (featureArrayIdentifier["title"].length > 0) {
	// 	outputHTML += '<h3>' + featureArrayIdentifier["title"] + '</h3>\n';
	// }
	// Now the name/Position and/or Thumbnail Image
	if ((featureArrayIdentifier["name"].length > 0) || (featureArrayIdentifier["position"].length > 0) || (featureArrayIdentifier["thumbnailImage"].length > 0)) {
		
		outputHTML += '<p class="centerednomarginbelow">';
		if ((featureArrayIdentifier["name"].length > 0) || (featureArrayIdentifier["position"].length > 0)) {
			// outputHTML += '<strong>' + featureArrayIdentifier["name"] + featureArrayIdentifier["position"] + '</strong>';
			outputHTML += '<h3>' + featureArrayIdentifier["name"] + featureArrayIdentifier["position"] + '</h3>';
		}
		// if (((featureArrayIdentifier["name"].length > 0) || (featureArrayIdentifier["position"].length > 0)) && (featureArrayIdentifier["thumbnailImage"].length > 0)) {
		//	outputHTML += '<br />\n';
		// }
		if (featureArrayIdentifier["thumbnailImage"].length > 0) {
			outputHTML += '<div class="centerednomarginbelow">';
			outputHTML += '<a href="' + featureHref + '"><img src="' + featureArrayIdentifier["thumbnailImage"] + '" alt="Image of ' + featureArrayIdentifier["namePosition"] + '" width="' + thumbnailImageWidth + '" height="' + thumbnailImageHeight + '" border="' + thumbnailImageBorder + '" /></a></div>';
		}
	}
	// Now the bulleted list
	if ((featureHref.length > 0) || (featureArrayIdentifier["indexPagePath"].length > 0)) {
		outputHTML += '<ul>\n';
		if (featureHref.length > 0) {
			if (featureArrayIdentifier["name"].length > 0) {
				featureListString = ' about ' + featureArrayIdentifier["name"];
			}
			outputHTML += '<li><a href="' + featureHref + '">Find out more' + featureListString + '</a></li>\n';
		}
		if (featureArrayIdentifier["indexPagePath"].length > 0) {
			if (featureArrayIdentifier["title"].length > 0) {
				indexPageString = 'More ' + featureArrayIdentifier["title"];
			} else {
				indexPageString = 'More Features';
			}
			outputHTML += '<li><a href="' + featureArrayIdentifier["indexPagePath"] + '">' + indexPageString + '</a></li>\n';
		}
		outputHTML += '</ul>\n';
	}
		
	// Now just for redundancy's sake, let's make sure that the featureHref is set to something.  If not, then don't output outputHTML!
	if (featureHref != "") {
		document.write(outputHTML);
		document.close();
	}
}
