function disableSelected(item_selected_dis, current_item) {
	if (item_selected_dis == current_item) {
		for (var i = 1; i < menu_array.length; ++ i) {
			if (menu_array[i] == item_selected_dis) {
//				alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className.substr(0, 4));
				var beginStyle = document.getElementById('menumoto' + i).className.substr(0, 4);
				document.getElementById('menumoto' + i).className = '';
				document.getElementById('menumoto' + i).className = beginStyle + ' visible';
//				alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className);
			}
		}
	} else {
		for (var i = 1; i < menu_array.length; ++ i) {
			if (menu_array[current_item] == item_selected_dis) {
				if (menu_array[i] == menu_array[current_item] && current_item != i && current_item > 0 && menu_array[current_item] > 0) {
//					alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className.substr(0, 4));
					var beginStyle = document.getElementById('menumoto' + i).className.substr(0, 4);
					document.getElementById('menumoto' + i).className = '';
					document.getElementById('menumoto' + i).className = beginStyle + ' unv';
//					alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className);
				}
			} else {
//				if (menu_array[i] == item_selected_dis && item_selected_dis > 0) {
				if (menu_array[i] > 0) {
//					alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className.substr(0, 4));
					var beginStyle = document.getElementById('menumoto' + i).className.substr(0, 4);
					document.getElementById('menumoto' + i).className = '';
					document.getElementById('menumoto' + i).className = beginStyle + ' unv';
//					alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className);
				}
			}
			if (menu_array[i] == current_item) {
//				alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className.substr(0, 4));
				var beginStyle = document.getElementById('menumoto' + i).className.substr(0, 4);
				document.getElementById('menumoto' + i).className = '';
				document.getElementById('menumoto' + i).className = beginStyle + ' visible';
//				alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className);
			}
		}
		if (menu_array[current_item] != item_selected_dis) {
			disableOneItemUp(item_selected_dis);
		}
	}
}

function disableOneItemUp(item_dis) {
	if (menu_array[item_dis] > 0) {
//		alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className.substr(0, 4));
		var beginStyle = document.getElementById('menumoto' + i).className.substr(0, 4);
		document.getElementById('menumoto' + i).className = '';
		document.getElementById('menumoto' + i).className = beginStyle + ' unv';
//		alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className);
		disableOneItemUp(menu_array[item_dis]);
	}
}

function selectItem(item_select_en) {
//	alert("Yes select = " + item_select_en + " --- selected = " + item_selected);
	if (item_selected == item_select_en) {
		for (var i = 1; i < menu_array.length; ++ i) {
			if (menu_array[i] == item_select_en && item_select_en > 0) {
//				alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className.substr(0, 4));
				var beginStyle = document.getElementById('menumoto' + i).className.substr(0, 4);
				document.getElementById('menumoto' + i).className = '';
				document.getElementById('menumoto' + i).className = beginStyle + ' unv';
//				alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className);
			}
			if (menu_array[i] == menu_array[item_select_en]) {
//				alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className.substr(0, 4));
				var beginStyle = document.getElementById('menumoto' + i).className.substr(0, 4);
				document.getElementById('menumoto' + i).className = '';
				document.getElementById('menumoto' + i).className = beginStyle + ' visible';
//				alert("i = " + i + " --- " + " Item = " + document.getElementById('menumoto' + i).className);
			}
		}
		item_selected = menu_array[item_select_en];
	} else {
//		alert("i = " + item_select_en + " --- " + " Item = " + document.getElementById('menumoto' + item_select_en).className);
		disableSelected(item_selected, item_select_en);
		item_selected = item_select_en;
	}
	if (moto_page_id_this > 0) {
		markItemIsSelectedAndVisiblePath(moto_page_id_this);
	}
}

function markItemIsSelected(select_page) {
	if (select_page > 0) {
		var newStyle = document.getElementById('menumoto' + select_page).className.substr(0, 4) + 'Select' + document.getElementById('menumoto' + select_page).className.substr(4);
		document.getElementById('menumoto' + select_page).className = '';
		document.getElementById('menumoto' + select_page).className = newStyle;
	}
}

function markItemIsSelectedAndVisiblePath(select_moto_item) {
//	alert('Visible item - ' + select_moto_item + ' selected mark page - ' + moto_page_id_this);
	if (select_moto_item > 0) {
		if (select_moto_item == moto_page_id_this) {
//			alert('Select is selected item - ' + select_moto_item);
			if (menu_array[select_moto_item] == item_selected) {
				for (var i = 1; i < menu_array.length; ++ i) {
					if (menu_array[i] == menu_array[select_moto_item] && i != select_moto_item) {
						var beginStyle = document.getElementById('menumoto' + i).className.substr(0, 4);
						document.getElementById('menumoto' + i).className = '';
						document.getElementById('menumoto' + i).className = beginStyle + ' visible';
					}
				}
			}
			var newStyle = document.getElementById('menumoto' + select_moto_item).className.substr(0, 4) + 'Select visible';
			document.getElementById('menumoto' + select_moto_item).className = '';
			document.getElementById('menumoto' + select_moto_item).className = newStyle;
		} else {
//			alert('visible item - ' + select_moto_item);
			var thisStyle = document.getElementById('menumoto' + select_moto_item).className;
			if (thisStyle.search('unv') > 0) {
				var newStyle = document.getElementById('menumoto' + select_moto_item).className.substr(0, 4);
				document.getElementById('menumoto' + select_moto_item).className = '';
				document.getElementById('menumoto' + select_moto_item).className = newStyle + ' visible';
			}
		}
		markItemIsSelectedAndVisiblePath(menu_array[select_moto_item]);
	}
}