/******************************************************************************
* xZann1Fonctions.js
*******************************************************************************

*******************************************************************************
*                                                                             *
* Copyright 2008									                          *
*                                                                             *
******************************************************************************/
/* Gestion redirection si pas de session active*/
function redirectCategory(url){
	if(url != "")
		document.location.href = url;
}

/* Gestion champ recherche */
function inputFocus(inputValue, inputId, searchTitle){
	if(inputValue == searchTitle && inputId == "fulltextField"){
		document.getElementById(inputId).value="";
	}else if(inputValue == "" && inputId == "fulltextField"){
		document.getElementById(inputId).value = searchTitle;
	}
}

function patchEmptyMenus()
{
	var lis = document.getElementsByTagName("LI");
	for(var i=0;i<lis.length;i++) {
		var li = lis[i];
		if(li.className.indexOf("nav1") >= 0) {
			var count = 0;
			var children = li.childNodes;
			var a = null;
			for(var j=0;j<children.length;j++) {
				var child = children[j];
				if(child.tagName == "UL") count++;
				if(child.tagName == "A") a = child;
			}
			if(count == 0 && a != null) {
				a.className = "empty";
			}
		}
		if(li.parentNode.className.indexOf("nav3") >= 0) {
			var count = 0;
			var children = li.childNodes;
			var span = null;
			for(var j=0;j<children.length;j++) {
				var child = children[j];
				if(child.tagName == "UL") count++;
				if(child.tagName == "SPAN") span = child;
			}
			if(count == 0 && span != null) {
				var children = span.childNodes;
				var a = null;
				for(var j=0;j<children.length;j++) {
					var child = children[j];
					if(child.tagName == "A") a = child;
				}
				if(a != null) {
					a.className = a.className + " empty";
				}
			}			
		}
	}
}

addLoadAction(patchEmptyMenus);