/**
 * Bongrain Foodservice - Javascript functions
 *
 * @version 2008-05-09
 *
 */
var bgfsCurrentMenu = '';
var bgfsEffect = null;
	
function showMenu(menuID) {

	// Type of effect. In product detail view show menu immediately without effects
	if (bgfsEffect == null && window.location.search.indexOf('ppid=') != -1) {
		bgfsEffect = false;
	} else {
		bgfsEffect = true;
	}

	// Params
	var menuPathNew = menuID.split('_');
	var menuPathCurrent = bgfsCurrentMenu.split('_');
	
	// hide current menu
	if (bgfsCurrentMenu) {

		// hide family
		if (menuPathCurrent[1] && menuPathCurrent[1] != menuPathNew[1] && $('productNavFamily_'+menuPathCurrent[1]) != null ) {
			$('productNavFamily_'+menuPathCurrent[1]).blindUp();
		}
		
		// hide group
		if (menuPathCurrent[2] && menuPathCurrent[2] != menuPathNew[2] && $('productNavGroup_'+menuPathCurrent[1]+'_'+menuPathCurrent[2]) != null) {
			$('productNavGroup_'+menuPathCurrent[1]+'_'+menuPathCurrent[2]).blindUp();
		}

		// hide category
		if (menuPathCurrent[3] && menuPathCurrent[3] != menuPathNew[3] && $('productNavCategory_'+menuPathCurrent[1]+'_'+menuPathCurrent[2]+'_'+menuPathCurrent[3]) != null) {
			$('productNavCategory_'+menuPathCurrent[1]+'_'+menuPathCurrent[2]+'_'+menuPathCurrent[3]).blindUp();
		}
	}
	
	// show new menu
	// show family
	if (menuPathNew[1] && menuPathCurrent[1] != menuPathNew[1] && $('productNavFamily_'+menuPathNew[1]) != null) {
		if (bgfsEffect) {
			$('productNavFamily_'+menuPathNew[1]).blindDown();
		} else {
			$('productNavFamily_'+menuPathNew[1]).show();
		}
	}
	
	// show group
	if (menuPathNew[2] && menuPathCurrent[2] != menuPathNew[2] && $('productNavGroup_'+menuPathNew[1]+'_'+menuPathNew[2]) != null) {
		if (bgfsEffect) {
			$('productNavGroup_'+menuPathNew[1]+'_'+menuPathNew[2]).blindDown();
		} else {
			$('productNavGroup_'+menuPathNew[1]+'_'+menuPathNew[2]).show();
		}
	}

	// show category
	if (menuPathNew[3] && menuPathCurrent[3] != menuPathNew[3] && $('productNavCategory_'+menuPathNew[1]+'_'+menuPathNew[2]+'_'+menuPathNew[3]) != null) {
		if (bgfsEffect) {
			$('productNavCategory_'+menuPathNew[1]+'_'+menuPathNew[2]+'_'+menuPathNew[3]).blindDown();
		} else {
			$('productNavCategory_'+menuPathNew[1]+'_'+menuPathNew[2]+'_'+menuPathNew[3]).show();
		}
	}
	
	bgfsCurrentMenu = menuID;
	
//	window.focus();
}

