/* fps.js
 *
 * this file contains all of the jscript for the adlerandco.com site.
 *
 * note that DreamWeaver puts some jscript in the HTML files themselves.
 *
 * known bugs:
 *	1.	ie mac does not show the correct image when opening an artist page with an imageNum specified in the URL
 *	2.	win ie pops in the original image before showing the correct image when opening an artist page with an imageNum specified
 *		in the URL
 */

function setInitialImage(theElem) {
	// set the image to the right one from the URL, if applicable


	var imageElem = document.getElementById(theElem);
	if ( imageElem )
		selectImageFromURL(theElem);
		
	// HACK: safari 1.3v312 has a nasty bug which causes the navigation images to be hidden
	// behind the colorbar divs.
	// HACK: stupid safari hack: we change a property of the navigation div to force a reflow of that
	// div, which fixes a bug in safari in which the navigation images don't show up on a page refresh.
	// we choose a property that we're not actually making use of. In this case, we use the 'color'
	// property. Since there is no text in the navigation div, this won't hurt anything.
	//var elem = document.getElementById('navigation');
	//elem.style.color = 'red';

}


/* preloadImages
 * preload images based on a given image's src. the prototype is:
 *		preloadImages( elementID, image1, image2, image3, ... )
 * where each image is found in the same path as the src attribute for the image element with the given elementID
 */
function preloadImages()
{
	var args = preloadImages.arguments;
	var theElem = args[0];
	var elem = document.getElementById(theElem);
	var path = elem.src;
	path = path.replace(/[^\/]+\.(jpg|gif|png)$/,'');	// peel off the trailing filename, e.g., filename.gif or filename.jpg

	var len = args.length-1;
	var imageArray = new Array(len);
	for(var i=0; i<len; i++)
	{
		imageArray[i] = new Image;
		imageArray[i].src = path+args[i+1];
	}	
}
