// JavaScript Document

// *** Preloading Images ***
// preload() checks that an image objects exists and then loops through all given arguments,
// presumably image files, and loads them into a dummy image object, caching them for future
// use.
function preload()
{
	if ( document.images )
	{
		var i, args = preload.arguments;
		for ( i = 0; i < args.length; i++ )
		{
			var image = new Image();
			image.src = args[i];
		}
	}
}

// *** Rollover Images ***
// swap() loads the file, newImage, into the image object with id, imageID.
function swap( imageID, newImage )
{
	document.getElementById( imageID ).src = newImage;
}

// *** Pop Up Windows ***
// popup will hold the window reference.  If it is null, there is no window reference.
var popup;

// openWindow() checks to see if a window already exists.  If it does, it loads the page 
// specified by url.  If it does not, it creates the window and loads the page specified
// by url.
function openWindow( url )
{
	if ( popup == null )
	{
		popup = window.open( url, '', 'toolbar=no,scrollbars=no,width=400,height=200');
	}
	else
	{
		popup.location = url;
	}
}

// closeWindow() closes the window referenced by popup and then nulls out the reference.
function closeWindow()
{
	popup.close();
	popup = null;
}