String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}



function swap_menu(element) {
	if (element.tagName.toLowerCase() == 'ul') {
//alert('ul');
		var listChilds = element.childNodes;
		for (var i = 0; i < listChilds.length; i++) {
			if ((listChilds.item(i).tagName == undefined) ||
				(listChilds.item(i).tagName == null) ||
				(listChilds.item(i).tagName.toLowerCase() != 'li'))
				continue;
			var entryChilds = listChilds.item(i).childNodes;
			listChilds.item(i).className = listChilds.item(i).className.replace('hover', '').trim();
			for (var j = 0; j < entryChilds.length; j++) {
				if ((entryChilds.item(j).tagName == undefined) ||
					(entryChilds.item(j).tagName == null) ||
					(entryChilds.item(j).tagName.toLowerCase() != 'ul'))
					continue;
				entryChilds.item(j).style.display = 'none';
			}
		}
	}
	else if (element.tagName.toLowerCase() == 'li') {
//alert('li');
		element.className = (element.className + ' hover').trim();
		var entryChilds = element.childNodes;
		element.parentNode.parentNode.blocked = true;
		for (var j = 0; j < entryChilds.length; j++) {
			if ((entryChilds.item(j).tagName == undefined) ||
				(entryChilds.item(j).tagName == null) ||
				(entryChilds.item(j).tagName.toLowerCase() != 'ul'))
				continue;
			entryChilds.item(j).style.display = 'block';
			if (element.blocked)
				element.blocked = false;
			else			
				swap_menu(entryChilds.item(j));
		}
	}
}

function doSearch(element)
{
	if (element.tagName.toLowerCase() == 'input' && arguments.length > 1)
	{
		var page = arguments[1][0];
		var param = arguments[1][1];

		var input = document.getElementById("searchFormInputMix");
		if (input != null)
		{
			input.name = param;
			input.form.action = page;
			if (input.value != "")
				input.form.submit();
		}
	}
}

function manageEvents(event)
{
	if(event.which == 13)
	{
	}
	return false;
}

//
/*
var desactiveEnter = function(e){ 
    if (!e) e = window.event;
	 if (e.keyCode == 13) {
	     return false;
	 } 
}
document.onkeypress = desactiveEnter;*/ // Par exemple
