/*
 * Javascript each tab should execute
 */
 
/*
 * This function checks which tab should be the "active" one, according to the
 * variable "activeTabName" in main.html. If this one isn't really activated,
 * it is activated now.
 */
function checkTabs() {
	coveringMenuItem = parent.getCoveringMenuItem(parent.activeTabName);
	activeTab = coveringMenuItem.getTab(parent.activeTabName);
	for (img = 0; img < coveringMenuItem.numberOfTabs(); img++) {
		tab = coveringMenuItem.getTab(img);
		if (!eval("document." + tab.getName())) {
			setTimeout("checkTabs()", 500);
			return;
		}
		eval("document." + tab.getName()).src = tab.getImageNormalSrc();
	}
	eval("document." + parent.activeTabName).src = activeTab.getImageActiveSrc();
}

/*
 * Returns:	the filename of this document
 */
function getFileName() {
	path = location.pathname;
	i = path.length - 1;
	while((i > 0) && (path.charAt(i) != '/') && (path.charAt(i) != '\\')) i -= 1;
	return path.substring(i + 1, path.length);
} 

/*
 * Main code
 */
 
// Check if we're in the right frame
if (self == top) document.location = "index.html";
checkTabs();
