var defaultfocuscp="";
var defaultfocusinput = "";
var opennodes = new Array();

function getParentWithClass(el,pTagName) {
	if (el == null) return null;
	else if (el.nodeType == 1 && el.className == pTagName)
		return el;
	else
		return getParentWithClass(el.parentNode, pTagName);
}

if(typeof HTMLElement!="undefined"){
		HTMLElement.prototype.__defineGetter__("innerText", function () {
		   var r = this.ownerDocument.createRange();
		   r.selectNodeContents(this);
		   return r.toString();
		});
		
}

function BuildSummary(o) {
	var txt = '';
	var etplus = '';
	var o = document.getElementById(o);

if (o) {
		allInput = o.getElementsByTagName("input");
		for (i=0; i<allInput.length;i++) {
			if (allInput[i].checked) {
				if (i==6) { etplus = ' et +'; }
				txt=txt+allInput[i].innerText+i+etplus+', ';
			}
		}
	}
	
	o = o.getAttribute("name")
	if (o) {
	o=document.getElementById(o+"Text");
	//if (txt.length>0) {
	
		if (o!=null) {
			txt=String(txt).substring(0,txt.length-2);
			
			if (o.tagName=="INPUT") 
				o.value=txt;
			else
				o.innerHTML=txt;
		}
		
	}
		
	//}
}


 function initDropdown() {
		var navRoot = document.getElementById("miniSearch");
		var allInput = navRoot.getElementsByTagName("input");
			for (i=0; i<allInput.length;i++) {
				node = allInput[i];
				
				if (node.getAttribute("type")=="checkbox") {
					node.onchange=function() {
						setTimeout('BuildSummary("'+getParentWithClass(this,"searchchoix").id+'")',10);
					}
					node.onclick=function() {
						setTimeout('BuildSummary("'+getParentWithClass(this,"searchchoix").id+'")',10);
					}

				}
			}
			var subnodes = navRoot.getElementsByTagName("DIV");
			for (i=0; i<subnodes.length; i++) {
				node = subnodes[i];
				if (node.nodeName=="DIV" && node.className=="searchchoix") {
						setTimeout('BuildSummary("'+node.id+'")',10);
						node.onmouseover=function() {
								o = document.getElementById(this.getAttribute("name")+"Liste");
								if (o) o.className+=" over";
								ClearOpenNodes();
								opennodes.push(o);
				  	}
	  				node.onmouseout=function() {
	  					o = document.getElementById(this.getAttribute("name")+"Liste");
						  ClearOpenNodes();
						  
	   				}
   			}
   			else if (node.nodeName=="DIV" && node.className=="dropdown") {
   				node.onmouseout=function() {ClearOpenNodes();}
   			}
  }
}

function ClearOpenNodes() {
	
	for (var i=0; i<opennodes.length;i++) {
		var o =opennodes[i];
		if(o)
			o.className=o.className.replace(" over", "");
	}
	opennodes=new Array();
}