function findPlayer(win)
{
	// Search the window hierarchy for an object named "Player"
	// Look in the current window (win) and recursively look in any child frames
	if (win.player != null) return win.player;

	if (win.length > 0) {
		for(var i = 0; i < win.length; i++) {
			var thePlayer = findPlayer(win.frames[i]);
			if (thePlayer != null) return thePlayer;
		}
	}
	return null;
}

function getPlayer()
{
	// start at the topmost window - findPlayer will recurse down through
	// all of the child frames
	var thePlayer = findPlayer(parent);
	if (thePlayer == null) thePlayer = findPlayer(top);
	// the Player wasn't found in the current window's hierarchy.  If the
	// current window has an opener (was launched by another window),
	// check the opener's window hierarchy.
	if(thePlayer == null)
		if(typeof(opener) != "undefined")
			if(opener != null)
				thePlayer = findPlayer(opener.top);
	return thePlayer;
}

function findFrame(name, frame)
{
	var oldFrameName = null;
	if (name == "navigation") {
		oldFrameName = "header";
	}

	if (typeof(frame) == "undefined") {
		frame = frames;
	}
	for (var i = 0; i < frame.length; i++) {
		if (frame[i].name == name || (oldFrameName && frame[i].name == oldFrameName)) {
			return frame[i];
		} else {
			var result = findFrame(name, frame[i]);
			if (result) return(result);
		}
	}
	return(null);
}

function InitializeStandardTree()
{
	var tree_frame = player.findFrame("tree");
	if (tree_frame) {
		tree_frame.initialize();
	}
}

function findStruct(win)
{
	if (win.struct != null) return win.struct;

	if (win.length > 0) {
		for(var i = 0; i < win.length; i++) {
			var theStruct = findStruct(win.frames[i]);
			if (theStruct != null) return theStruct;
		}
	}
	return null;
}

function getStruct()
{
	var theStruct = findStruct(parent);
	if (theStruct == null) theStruct = findStruct(top);

	if(theStruct == null) {
		if(typeof(opener) != "undefined") {
			if(opener != null) theStruct = findStruct(opener.top);
		}
	}			
	return theStruct;
}

