﻿// Preload image buttons
if (document.images)
{
	var image_array = new Array();

	// path to the directory with images
	var path = '/Media/Image/Design/Buttons/';

	// enumeration of the "active" images
	image_array[0] = path + "LargeGreenEnd.png";
	image_array[1] = path + "LargeGreenEnd_Hover.png";
	image_array[2] = path + "LargeGreenMid.png";
	image_array[3] = path + "LargeGreenMid_Hover.png";
	image_array[4] = path + "LargeGreenStart.png";
	image_array[5] = path + "LargeGreenStart_Hover.png";
	image_array[6] = path + "CategoryBlueEnd.png";
	image_array[7] = path + "CategoryBlueEndHover.png";
	image_array[8] = path + "CategoryBlueMid.png";
	image_array[9] = path + "CategoryBlueMidHover.png";
	image_array[10] = path + "CategoryBlueStart.png";
	image_array[11] = path + "CategoryBlueStartHover.png";
	image_array[12] = path + "CategoryGreenEnd.png";
	image_array[13] = path + "CategoryGreenEndHover.png";
	image_array[14] = path + "CategoryGreenMid.png";
	image_array[15] = path + "CategoryGreenMidHover.png";
	image_array[16] = path + "CategoryGreenStart.png";
	image_array[17] = path + "CategoryGreenStartHover.png";
	image_array[18] = path + "CategoryOrangeEnd.png";
	image_array[19] = path + "CategoryOrangeEndHover.png";
	image_array[20] = path + "CategoryOrangeMid.png";
	image_array[21] = path + "CategoryOrangeMidHover.png";
	image_array[22] = path + "CategoryOrangeStart.png";
	image_array[23] = path + "CategoryOrangeStartHover.png";
	image_array[24] = path + "CategoryRedEnd.png";
	image_array[25] = path + "CategoryRedEndHover.png";
	image_array[26] = path + "CategoryRedMid.png";
	image_array[27] = path + "CategoryRedMidHover.png";
	image_array[28] = path + "CategoryRedStart.png";
	image_array[29] = path + "CategoryRedStartHover.png";
	image_array[30] = path + "SmallBlueEnd.png";
	image_array[31] = path + "SmallBlueEndHover.png";
	image_array[32] = path + "SmallBlueMid.png";
	image_array[33] = path + "SmallBlueMidHover.png";
	image_array[34] = path + "SmallBlueStart.png";
	image_array[35] = path + "SmallBlueStartHover.png";
	image_array[36] = path + "SmallGreenEnd.png";
	image_array[37] = path + "SmallGreenEndHover.png";
	image_array[38] = path + "SmallGreenStart.png";
	image_array[39] = path + "SmallGreenStartHover.png";
	image_array[40] = path + "SmallGreenMid.png";
	image_array[41] = path + "SmallGreenMidHover.png";

	var preload_image = new Array();

	for (var i = 0; i < image_array.length; i++)
	{
		preload_image[i] = new Image();
		preload_image[i].src = image_array[i];
	}
}

function HoverButton(id, css)
{
	document.getElementById(id + "_in_1").className = css + "StartHover";
	document.getElementById(id + "_in_2").className = css + "MidHover";
	document.getElementById(id + "_in_3").className = css + "EndHover";
}

function UnhoverButton(id, css)
{
	document.getElementById(id + "_in_1").className = css + "Start";
	document.getElementById(id + "_in_2").className = css + "Mid";
	document.getElementById(id + "_in_3").className = css + "End";
}

function ToggleExpandCollapse(callerDiv, targetDivId)
{
	var targetDiv = document.getElementById(targetDivId);

	if (callerDiv.className == "ExpandCollapseButtonExpanded")
	{
		callerDiv.className = "ExpandCollapseButtonCollapsed";
		targetDiv.style.display = "none";
	}
	else
	{
		callerDiv.className = "ExpandCollapseButtonExpanded";
		targetDiv.style.display = "block";
	}
}

function HoverThumbnail(id)
{
	document.getElementById(id + "_img").style.display = 'none';
	document.getElementById(id + "_txt").style.display = 'block';
}

function UnhoverThumbnail(id)
{
	document.getElementById(id + "_txt").style.display = 'none';
	document.getElementById(id + "_img").style.display = 'block';
}

function CheckReturnKey(e, submitButtonId)
{
	var keynum;
	if (window.event) // IE
		keynum = e.keyCode;
	else if (e.which) // Netscape/Firefox/Opera
		keynum = e.which;

	if (keynum == 13)
	{
		document.getElementById(submitButtonId).click();
		return false;
	}
	return true;
}
