
function initialise()
{
   var s = document.all[ 'FMColour' ];

   fractalMapShowSplash( 'visible', false );
   timerID = setInterval("tickProgress()", 1000);
}

function fractalMapLoaded()
{
	document.all[ 'FractalMap' ].Display.setOption('option', 'analytic:'+document.all['FMColour'].options[document.all['FMColour'].selectedIndex].value);
	document.all[ 'FractalMap' ].Display.setOption('option', 'sort:'+document.all['FMSort'].options[document.all['FMSort'].selectedIndex].value);
	document.all[ 'FractalMap' ].Display.setOption('option', 'hierarchy:'+document.all['FMGroup'].options[document.all['FMGroup'].selectedIndex].value);
}

function fractalMapEventsOnOptionChanged( opt )
{
	var i;
	var s;

	if ( opt.substring(0,9) == 'analytic:' )
	{
		opt = opt.substring(9);

		if (opt == 'RANK')
		{
			document.images['legend'].src = 'images/legend1.gif';
			document.all['FMLegend'].className = 'legendon';
		}
		else if (opt == 'RANK_BLUE')
		{
			document.images['legend'].src = 'images/legend3.gif';
			document.all['FMLegend'].className = 'legendon';
		}
		else if (opt == 'SPECTRUM')
		{
			document.images['legend'].src = 'images/legend2.gif';
			document.all['FMLegend'].className = 'legendon';
		}
		else
		{
			document.images['legend'].src = 'images/legend0.gif';
			document.all['FMLegend'].className = 'legendoff';
		}
		
		DropDownSelect(document.all['FMColour'], opt);
	}
	else if ( opt.substring(0,5) == 'sort:' )
	{
		DropDownSelect(document.all['FMSort'], opt.substring(5));
	}
	else if ( opt.substring(0,10) == 'hierarchy:' )
	{
		DropDownSelect(document.all['FMGroup'], opt.substring(10));
	}
}

function DropDownSelect(dropdown, optionid)
{
	for (x=0; x<dropdown.children.length; x++)
	{
		if (dropdown.children.item(x).value == optionid)
		{
			dropdown.selectedIndex = dropdown.children(x).index;
			return;
		}
	}
}
