<!-- Script to show the all categories menu -->
/* SE1.0.3.1: All categories menu : start. */
var timer1 = null;
function showCategoriesMenu() {	
	// all categories set-up
	var allCategories = document.getElementById("allCategories");
	if (!allCategories) { return; }
	
	var categoriesMenu = document.getElementById('categoriesMenu');
	if (!categoriesMenu) { return; }/* SE1.0.3.1: Null check. */
	
	showL3Menu(allCategories);
	
	if (allCategories) {
		if (categoriesMenu.style.visibility == "hidden") {
			// initialization (IE does not load menu when screen dimensions are reduced otherwise)
			categoriesMenu.style.left = "-999px";
		}
		
		// get allCategories list item absolute position (climb element tree)
		var x = 0;
		var coord = getElementCoordinates(allCategories);
				// place the menu arrow at the end of the list item
		//   x + list item width - menu width* - "CATEGORIES" width (81)
		//   *IE incorrectly assigns categoriesMenu.clientWidth so child is used with padding
		var menuChild = getElementsByClassName(categoriesMenu, "")[0];
		x = coord.x 
					+ allCategories.clientWidth 
					- menuChild.offsetLeft - menuChild.clientWidth 
					- 81;
					
		// manually define width (IE fills right)
		if (menuChild.clientWidth > 0) {
			categoriesMenu.style.width = menuChild.clientWidth.toPixels();
		}
		
		categoriesMenu.style.left = x.toPixels();
	}
	categoriesMenu.style.visibility = 'visible';
	
	if (timer1 != null) { clearTimeout(timer1); }
}
function hideMenu() {
	// free timer
	if (timer1 != null) {
		clearTimeout(timer1);
		timer1 = null;
	};
	
	if (document.getElementById('categoriesMenu')) {/* SE1.0.3.1: Null check : start. */
		document.getElementById('categoriesMenu').style.visibility = 'hidden'; // hide
	}/* SE1.0.3.1: Null check : end. */
	
	// force menu close
	if (window.obj && window.obj == document.getElementById("allCategories")) {
		closeL3Menu();
	}
}
function hideCategoriesMenu() {
	timer1 = setTimeout('hideMenu();', 500);
}
/* SE1.0.3.1: All categories menu : end. */
