function hpo_nav_checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

bw=new hpo_nav_checkBrowser();

var theTime=15; // en mlseconde
var bIsToStop = false;
var bIsToClose = false;
var iCoef = 10;
/*if (bw.ie6)
	iCoef = 10;
if (bw.ie7)
	iCoef = 5;*/

function showdt(id){
	
	var iNbPage = 1;
	while (document.getElementById("dt_"+iNbPage))
		iNbPage++;
	
	iCount = 1;
	while (document.getElementById("dt_"+iCount)){
		if (iCount != id) {
			if (iCount==1)
				document.getElementById("dt_"+iCount).className='menu_top';
			else if (iCount==iNbPage-1){
				if (document.getElementById("dt_"+iCount).className != "menu_o")
					document.getElementById("dt_"+iCount).className='menu_bottom';
			} else
				document.getElementById("dt_"+iCount).className='menu';
		} else {
			if (iCount==1)
				document.getElementById("dt_"+iCount).className='menu_top_o';
			else if (iCount==iNbPage-1){
				document.getElementById("dt_"+iCount).className='menu_bottom_o';
			} else
				document.getElementById("dt_"+iCount).className='menu_o';
		}
		iCount++;
	}
}

function showdd(id) {
	if (document.getElementById("dd_"+id).offsetHeight==0){// && !bIsToStop){
		
		document.getElementById("dd_"+id).style.height='auto';
		document.getElementById("dd_"+id).style.display='block';
		var iMaxH = document.getElementById("dd_"+id).offsetHeight+1;
	
		document.getElementById("dd_"+id).style.height=0;
		
		var iNbPage = 1;
		while (document.getElementById("dt_"+iNbPage))
			iNbPage++;
		
		if (id==1)
			document.getElementById("dt_"+id).className='menu_top_o';
		else
			document.getElementById("dt_"+id).className='menu_o';
		
		// on ferme les menus
		//closealldd(id, iNbPage);
		// on ouvre le bon menu
		opendd(id,iMaxH,iNbPage);
		//bIsToStop = setTimeout("opendd("+id+","+iMaxH+","+iNbPage+")",theTime);
	}		
}

function opendd(id, iMaxH, iNbPage){
	clearTimeout(bIsToStop);
	if (document.getElementById("dd_"+id).offsetHeight<iMaxH){
		//initPos = parseInt(document.getElementById("dd_"+id).style.height);
		initPos = parseInt(document.getElementById("dd_"+id).offsetHeight);
		tmpH = 0;
		for (i=1;i<iCoef;i++){
			if (document.getElementById("dd_"+id).offsetHeight<iMaxH)
				tmpH = initPos+i;
		}
		document.getElementById("dd_"+id).style.height = tmpH+"px";
		if (document.getElementById("dd_"+id).offsetHeight<iMaxH)
			bIsToStop = setTimeout("opendd("+id+","+iMaxH+","+iNbPage+")",theTime);
		else
			closealldd(id, iNbPage);
			
	}
}

function closealldd(id, iNbPage){
	iCount = 1;
	exitFunct = 0;
	while (document.getElementById("dt_"+iCount)){
		
		if (iCount != id) {
		
			if (iCount==1)
				document.getElementById("dt_"+iCount).className='menu_top';
			else if (iCount==iNbPage-1){
				if (document.getElementById("dt_"+iCount).className != "menu_o selected")
					document.getElementById("dt_"+iCount).className='menu_bottom';
			} else
				document.getElementById("dt_"+iCount).className='menu';
			
			closedd(iCount);
		}
		iCount++;
	}
}

function closedd(id){
	if (document.getElementById("dd_"+id) && (document.getElementById("dd_"+id).className=='' || document.getElementById("dd_"+id).className=='smenuend')){
		clearTimeout(bIsToClose);
		if (document.getElementById("dd_"+id).offsetHeight>0){
			//initPos = parseInt(document.getElementById("dd_"+id).style.height);		
			initPos = parseInt(document.getElementById("dd_"+id).offsetHeight);
			tmpH = 0;
			for (i=1;i<iCoef;i++){
				if (document.getElementById("dd_"+id).offsetHeight>0)
					tmpH = initPos-i;
			}
			document.getElementById("dd_"+id).style.height = tmpH+"px";
			
			if (document.getElementById("dd_"+id).offsetHeight>0)
				setTimeout("closedd("+id+")",theTime);
		}
	}
}