﻿/* topbar.js, for activating the top "toolbar" in most pages */

function readjust(n, whichones)
/*
	n is the number of the icon to be brightened, when all the others are to be dimmed
	the string argument: if the i-th character is '-', don't do it
	NOTE that string chars start with 0, and 0 isn't tested, but there is
	such a character. Suggest starting each one with 'X'. Then a
	typical argument would be 'X--3---7-9'. As of now, we expect ten
	characters every time an arguement of this type is passed.
*/
{
	for (j=1; j<11; j++)
	{
		if (whichones.charAt(j) != '-')
		{
			if (j == n)
				brighten(j, true);
			else
				brighten(j, false);
		}

/*
			{
			alert(j)
			brighten(j, (j == n) );
			}
*/
	}
}

function brighten(n, whether)
/*
	the boolean argument: true if you want the color icon, false if the grayed
*/
{
	/* the "try" and "catch" clauses are for debugging */
	try{ 
	switch(n)
	{
		case 1:
			if (whether)
				document.icon1.src='../icon1.jpg';
			else
				document.icon1.src='../icon1bw.jpg';
		break;
		case 2:
			if (whether)
				document.icon2.src='../icon2.jpg';
			else
				document.icon2.src='../icon2bw.jpg';
		break;
		case 3:
			if (whether)
				document.icon3.src='../icon3.jpg';
			else
				document.icon3.src='../icon3bw.jpg';
		break;
		case 4:
			if (whether)
				document.icon4.src='../icon4.jpg';
			else
				document.icon4.src='../icon4bw.jpg';
		break;
		case 5:
			if (whether)
				document.icon5.src='../icon5.jpg';
			else
				document.icon5.src = '../icon5bw.jpg';
		break;
		case 6:
			if (whether)
				document.icon6.src='../icon6.jpg';
			else
				document.icon6.src='../icon6bw.jpg';
		break;
		case 7:
			if (whether)
				document.icon7.src='../icon7.jpg';
			else
				document.icon7.src='../icon7bw.jpg';
		break;
		case 8:
			if (whether)
				document.icon8.src='../icon8.jpg';
			else
				document.icon8.src='../icon8bw.jpg';
		break;
		case 9:
			if (whether)
				document.icon9.src="../icon9.jpg";
			else
				document.icon9.src="../icon9bw.jpg";
		break;
		case 10:
			if (whether)
				document.icona.src="../icona.jpg";
			else
				document.icona.src="../iconabw.jpg";
		break;
	} 
	} 

catch (ex)
	{
		alert(ex);        
	}

}
