var varPreviousNextIndex = 1;
var MM_contentVersion = 8;
var MM_FlashCanPlay = false;

CheckFlash();

function getCurrentYear()
{
	var d = new Date();
	document.write(d.getFullYear());
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Used in displaying flash
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function CreateControl(DivID, CLSID, ObjectID, CODEBASE, WIDTH, HEIGHT, MoviePath, MOVIE, BGCOLOR)
{
	var d = document.getElementById(DivID);
	d.innerHTML = '<OBJECT classid="' + CLSID + '" id="' + ObjectID + '" width="' + WIDTH + '" height="' + HEIGHT +'">' +
					'\n<PARAM name="Codebase" value="' + CODEBASE + '" />' +
					'\n<PARAM name="FlashVars" value="xmlPath=' + MoviePath + 'data.xml" />' +
					'\n<PARAM name="Movie" value="' + MoviePath + MOVIE + '" />' +
					'\n<PARAM name="AutoStart" value="-1" />' +
					'\n<PARAM name="AllowScriptAccess" value="always" />' +
					'\n<PARAM name="Quality" value="high" />' +
					'\n<PARAM name="BGColor" value="' + BGCOLOR + '" />' +
					'\n<PARAM name="WMode" value="transparent" />' +
					'\n<PARAM name="Menu" value="false" />' +
					'\n<EMBED src="' + MoviePath + MOVIE + '" quality="high" wmode="transparent" flashvars="xmlPath=' + MoviePath + 'data.xml" menu="false" swLiveConnect="FALSE" width="' + WIDTH + '" height="' + HEIGHT +'" name="' + ObjectID + '" allowScriptAccess="always" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />' +
					'\n</OBJECT>';
}

function CheckFlash()
{
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if (plugin)
	{
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i)
		{
			if (isNaN(parseInt(words[i])))
			continue;
			var MM_PluginVersion = words[i];
		}
		MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1))
	{
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
		document.write('on error resume next \n');
		document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
		document.write('</SCR' + 'IPT\> \n');
	}
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Used in displaying previous and next
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function displayPreviousNext(intLength, intItemsPerColumn, intColumnsToDisplay, varPrefix)
{
	var intColumns = Math.ceil(intLength / intItemsPerColumn);

	for (i = 1; i <= intColumns; i++)
	{
		if (i <= intColumnsToDisplay)
		{
			document.getElementById(varPrefix + i).style.display = "block";
		}
		else
		{
			document.getElementById(varPrefix + i).style.display = "none";
		}
	}
	if (intColumns <= intColumnsToDisplay)
	{
		document.getElementById("show_next").style.display = "none";
		document.getElementById("hide_next").style.display = "block";
	}
}

function scrollPreviousNext(varIncrement, intLength, intItemsPerColumn, intColumnsToDisplay, varPrefix)
{
	var intColumns = Math.ceil(intLength / intItemsPerColumn);

	varPreviousNextIndex = varPreviousNextIndex + varIncrement;
	if (varPreviousNextIndex <= 1)
	{
		document.getElementById("show_previous").style.display = "none";
		document.getElementById("hide_previous").style.display = "block";
		varPreviousNextIndex = 1;
	}
	else
	{
		document.getElementById("show_previous").style.display = "block";
		document.getElementById("hide_previous").style.display = "none";
	}
	if (varPreviousNextIndex > (intColumns - intColumnsToDisplay))
	{
		document.getElementById("show_next").style.display = "none";
		document.getElementById("hide_next").style.display = "block";
		varPreviousNextIndex = intColumns - (intColumnsToDisplay - 1);
	}
	else
	{
		document.getElementById("show_next").style.display = "block";
		document.getElementById("hide_next").style.display = "none";
	}
	for (i = 1; i <= intColumns; i++)
	{
		var varTopItem = intColumnsToDisplay + (varPreviousNextIndex - 1);
		if (varTopItem > intColumns)
		{
			varTopItem = intColumns;
		}
		if ((i >= varPreviousNextIndex) && (i <= varTopItem))
		{
			document.getElementById(varPrefix + i).style.display = "block";
		}
		else
		{
			document.getElementById(varPrefix + i).style.display = "none";
		}
	}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
