/* +----------------------------------------------------+ */
/* | JavaScript used on miketaigman.com                 | */
/* +----------------------------------------------------+ */

/**
 * Path to images in WP theme directory
 */
var imagePath = "/content/themes/miketaigman/images";

/**
 * highlightMenu() - Swap menu items on mouseover/out
 * 
 * @param	string	target		Menu link target
 * @param	string	state		Requested state: on/off
 */
function highlightMenu(image, state)
{
	if (state == "on") {
		image.src = imagePath + "/menu-" + image.id + "-hover.png";
	} else if (state == "off") {
		image.src = imagePath + "/menu-" + image.id + "-inactive.png";
	}
	return true;
}

/**
 * preloadImages() - Preload certain graphical UI elements
 */
function preloadImages()
{
	var images = new Array();
	var links  = new Array(
		'about', 'performance', 'educational', 'faq', 'download', 'blog'
	);
	count = links.length;
	for (var i = 0; i < count; i++) {
		var imgSrc = imagePath + '/menu-' + links[i] + '-hover.png';
		images[i] = document.createElement('img');
		images[i].setAttribute('src', imgSrc);
	}
	return true;
}

/** Add onLoad events to queue **/
addLoadEvent(preloadImages);


