// *** flipMenu 2.02 by Phasis (c) 2003
// *** Works in IE4+ and NS6+

// *** USER VARIABLES ***

flipOpenMultipleMenus = false;	// ** Allow multiple menus to fold out without closing all the other open ones.

flipLeftMargin = 16;		// ** Margin between the left side of the browser and the menu.
flipRightMargin = 0;		// ** Margin between the right side of the browser and the menu.


// *** DO NOT CHANGE ANYTHING AFTER THIS POINT ***

browserIE4 = (document.all && navigator.userAgent.indexOf("Opera") == -1);
browserNS6 = (document.getElementById && !document.all);

function toggleFlip(theElement) {
	var isContained = false;
	if (browserNS6) theElement = theElement.target; else theElement = event.srcElement;
	if (theElement.id == "flipMainMenu") isContained = true; else {
		while ((browserIE4 && theElement.parentElement) || (browserNS6 && theElement.parentNode)) {
			if (theElement.id == "flipMainMenu" || theElement.id == "flipMainItem" || theElement.id == "flipSubMenu" || theElement.id == "flipSubItem") {
				if (theElement.id == "flipMainMenu" || theElement.id == "flipSubMenu") isContained = true; else isContained = false;
				break;
			}
			if (browserNS6) theElement = theElement.parentNode; else theElement = theElement.parentElement;
		}
	}

	if (isContained) {
		if (browserNS6) flipContent = theElement.nextSibling.nextSibling; else flipContent = theElement.all.tags("UL")[0];
		if (flipContent.style.display == "none") {
			if (flipContent.id == "flipMainItem" && !flipOpenMultipleMenus) closeAllFlips();
			flipContent.style.display = "";
			theElement.style.listStyleImage = "url(" + flipImg_openFolder + ")";
		} else {
			flipContent.style.display = "none";
			theElement.style.listStyleImage = "url(" + flipImg_closedFolder + ")";
		}
	}
}

function closeAllFlips() {
	if (browserIE4) {
		for (var aCur = 0; aCur < document.all.tags("UL").length; aCur++) {
			var flipID = document.all.tags("UL")[aCur].id;
			if (flipID == "flipMainItem") document.all.tags("UL")[aCur].style.display = "none";
		}
		for (var aCur = 0; aCur < document.all.tags("LI").length; aCur++) {
			var flipID = document.all.tags("LI")[aCur].id;
			if (flipID == "flipMainMenu") document.all.tags("LI")[aCur].style.listStyleImage = "url(" + flipImg_closedFolder + ")";
		}
	}

}

if (browserIE4 || browserNS6) document.onclick = toggleFlip;

document.write("<style>\n" +
	"<!--\n" +
	"ul { padding-left:0; margin-left:" + flipLeftMargin + "; margin-right: " + flipRightMargin + " }\n" +
	"#flipMainMenu { cursor:pointer; cursor:hand; list-style-image:url(" + flipImg_closedFolder + ") }\n" +
	"#flipMainItem { list-style-image:url(" + flipImg_subItem + ") }\n" +
	"#flipSubMenu { cursor:pointer; cursor:hand; list-style-image:url(" + flipImg_closedFolder + ") }\n" +
	"#flipSubItem { list-style-image:url(" + flipImg_subItem + ") }\n" +
	"//-->\n" +
	"</style>");
