

// Handler for loading the top level areas from somewhere other than the navbar frame.
function handleLoadArea(xsArea, xsPathToRoot) {
	top.resetPathGlobals();
	switch (xsArea) {
		case 'toolkit':
			top.NAVBAR.notify("buttonClick", "toolkit", xsPathToRoot);
			break;
		case 'see':
			top.NAVBAR.notify("buttonClick", "see", xsPathToRoot);
			break;
		case 'collaborate':
			top.NAVBAR.notify("buttonClick", "collaborate", xsPathToRoot);
			break;
		default:
			top.document.location = "../index.html";		
			break;	
	}
}

// Returns file path for frame index page.  Cased out for leftnavbar and stage frames.
function getToolkitFilePath (xsFrameName) {
	switch (xsFrameName) {
		case 'leftnavbar':
			var vsSection 		= top.gsSection;			//get the (global) section name
			if (vsSection == null || vsSection == "") { vsSection = "getstarted"; } //default value
			vsFilePath = vsSection + ".html";
			break;
		case 'stage':
			vsFilePath = "../" + buildToolkitStagePath();
			break;
		default:
			alert("getToolkitFilePath() was used incorrectly.");		
			break;	
	}
	//alert(xsFrameName + ": vsFilePath= " + vsFilePath);
	return vsFilePath;
}

// Construct the path plus filename to a page.  Helper function.
function buildToolkitStagePath () {
	var vsSection		= top.gsSection;
	var vsSubsection	= top.gsSubsection;
	var vsStep			= top.gsStep;
	var vsFilename		= top.gsFilename;
	var vsPath			= "";

	//build the path string
	if (vsSection != null && vsSection != "") {
		vsPath = vsPath + vsSection + "/";
		
		if (vsSubsection != null && vsSubsection != "") {
			vsPath = vsPath + vsSubsection + "/";
			
			if (vsStep != null && vsStep != "") {
				vsPath = vsPath + vsStep + "/";	
			}
		}
	} else {
		vsPath		= "getstarted/";		// default value
	}
	if (vsFilename == null || vsFilename == "") {
		vsFilename = "index.html";			// default value
	}
	vsPath = vsPath + vsFilename;
	//resetPathGlobals();						//reset all the globals
	return vsPath;

}

function resetPathGlobals() {
	top.gsArea			= null;
	top.gsSection		= null;
	top.gsSubsection	= null;
	top.gsStep			= null;
	top.gsFilename		= null;
}

// Return string for file path in the 'see and do' area.
function getSeeAndDoFilePath() {
	var vsSection		= top.gsSection;
	var vsSubsection	= top.gsSubsection;
	var vsStep			= top.gsStep;
	var vsFilename		= top.gsFilename;
	var vsPath			= "../";

	//build the path string
	if (vsSection != null && vsSection != "") {
		vsPath = vsPath + vsSection + "/";
		
		if (vsSubsection != null && vsSubsection != "") {
			vsPath = vsPath + vsSubsection + "/";
			
			if (vsStep != null && vsStep != "") {
				vsPath = vsPath + vsStep + "/";	
			}
		}
	} else {
		vsPath		= "../intro/";		// default value
	}
	if (vsFilename == null || vsFilename == "") {
		vsFilename = "index.html";			// default value
	}
	vsPath = vsPath + vsFilename;
	//resetPathGlobals();						//reset all the globals
	return vsPath;
}
