function alignImages(containerId)
{
	if (col = document.getElementById(containerId))
	{
		var nodecount = col.childNodes.length - 1;
		var imgarray = new Array();
		var contentheight = 0;	

		//make image array from nodes
		for (var i=0; i<=nodecount; i++)
		{
			//add node to image array and calc content height
			if (col.childNodes[i].nodeName == "IMG")
			{
				imgarray.push(col.childNodes[i]);
				contentheight += col.childNodes[i].height;
			}
		}

		var imgcount = imgarray.length - 1;

		if (imgcount >= 0)
		{
			//vars, calc of the margins between images (only works if there are more than one), starting position
			var frameheight = 378;
			var framewidth = 351;
			var marginamt = 20;
			contentheight += marginamt * imgcount;
			var starttop = (frameheight - contentheight) / 2;

			//loop through each element to position it
			for (var i=0; i<=imgcount; i++)
			{
				//set the top and left
				imgarray[i].style.top = starttop + 'px';
				imgarray[i].style.left = (framewidth - imgarray[i].width) / 2 + 'px';

				//increment the starting point
				starttop += imgarray[i].height + marginamt;
			}
		}
	}
}

//changes the attributes of the prevbtn link for non-IE so they just go back to the index page (IE bug allows to go to the previous page even if the page was reloaded while grading)
function setTestNav()
{
	var prevbtn = document.getElementById('prevbtn');
	var backtolessonbtn = document.getElementById('backtolessonbtn');

	//test for non-IE
	if (!(navigator.appName == "Microsoft Internet Explorer") && (prevbtn) && (prevbtn.attributes))
	{
		//set the attributes of the prevbtn
		prevbtn.attributes.getNamedItem('href').value = 'index.htm';
		prevbtn.attributes.getNamedItem('onclick').value = '';
	}

	if (!(navigator.appName == "Microsoft Internet Explorer") && (backtolessonbtn) && (backtolessonbtn.attributes))
	{
		//set the attributes of the backtolessonbtn
		backtolessonbtn.attributes.getNamedItem('href').value = 'index.htm';
		backtolessonbtn.attributes.getNamedItem('onclick').value = '';
	}
}

//function for opening popups for definitions
function openExp(anchorName)
{
	var newWind;
	newWind = open('explanations.htm#' + anchorName, 'explanationWindow', 'directories=0,height=200,left=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,width=300', false);
	newWind.focus();
}

//opens links passed in as a new window without the toolbars -- if the window is not named "OrganTutorChildWin" then assume it is the main parent else open the location in the current window
function openLink(url)
{
	//test window relationship and browser
	if ((window.name == "OrganTutorChildWin") && (navigator.appName == "Microsoft Internet Explorer"))
	{
		//child windows in IE just change the location
		window.location.href = url;
	}
	else
	{
		//the parent window and non-IE, child windows open a new window for links
		newWind = window.open(url, '', 'directories=0,height=513,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=1,width=770', false);
		newWind.name = "OrganTutorChildWin";
		newWind.focus();

		//non-IE, child windows close once the new window is open
		if (window.name == "OrganTutorChildWin")
		{
			newWind.parent = window.parent;
			window.close();
		}
	}
}

//opens links passed in as a new window without the toolbars -- if the window is not named "OrganTutorChildWin" then assume it is the main parent else open the location in the current window
function openPopup(url)
{
		//the parent window and non-IE, child windows open a new window for links
		newWind = window.open(url, '', 'directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=1', false);
		newWind.focus();
}

function resizeWindow(contentWidth, contentHeight)
{
	//test browser and resize
	if (navigator.appName == "Microsoft Internet Explorer")
	{
		//IE
		window.resizeBy(contentWidth - document.getElementsByTagName('html')[0].clientWidth, contentHeight - document.getElementsByTagName("html")[0].clientHeight);
	}
	else if ((navigator.appName == "Netscape") && (navigator.userAgent.toLowerCase().indexOf('safari') == - 1))
	{
		//Netscape & Mozilla
		window.innerHeight = contentHeight;
		window.innerWidth = contentWidth;
	}
	else if ((navigator.appName == "Netscape") && (navigator.userAgent.toLowerCase().indexOf('safari') != - 1))
	{
		//Safari
		window.resizeBy(contentWidth - window.innerWidth, contentHeight - window.innerHeight);
	}
	else
	{
		//Unsupported browser
		window.resizeTo(screen.availWidth, screen.availHeight);
	}
}

//used to display images that are hidden
function toggleHidden(hiddenObjId)
{
	document.getElementById(hiddenObjId).style.visibility = 'visible';
	return(false);
}