function getElementStyle(id, type, what){
//	alert(id+" "+type+" "+what);
	var oThis	= document.getElementById(id);
	var isIE		= ((document.all)? true : false);
	var tabWhat	= new Array;
	var toReturn	= new Array;
	tabWhat	= what.split(",");

	for ( var i=0; i<tabWhat.length; i++) {
		if (tabWhat[i]=='height')	{
			toReturn['height']	= ((isIE)? oThis.currentStyle.height : getComputedStyle(oThis, null).height);
			if (toReturn['height']=='auto') toReturn['height'] = oThis.offsetHeight;
		}
		if (tabWhat[i]=='width')	toReturn['width']		= ((isIE)? oThis.currentStyle.width : getComputedStyle(oThis, null).width);
		if (tabWhat[i]=='offsetHeight') toReturn['offsetHeight'] = oThis.offsetHeight;
	}
	if (type=='int') {
		toReturn['height']	= parseFloat(toReturn['height']);
		toReturn['width']		= parseFloat(toReturn['width']);
	}
	if (type=='txt') {
		toReturn['offsetHeight']	= toReturn['offsetHeight']+'px';
	}
	return toReturn;
}

var maxi = null;
///////////////////////////////////////////

function swap_m(img_name,img_src,nochange)
{
	swap = eval('document.images.'+img_name);
	noext = ((img_src.length)-5);
	state = img_src.substr(noext,1)
	if ((state!=1)) {
		noext2 = ((img_src.length)-4);
		src_trim = img_src.substring(0,noext2)
		swap.src=src_trim+"1.gif";
	}
	if ((state==1)&&(nochange=='')) {
		noext2 = ((img_src.length)-5);
		src_trim = img_src.substring(0,noext2)
		swap.src=src_trim+".gif";
	}
}

function divmenu(divID, parentdivID)
{
	var theDoc	= document;
	var theName	= divID.substr(0,3);
	elementCount= eval("theDoc.menu."+theName+".value;");

	elementCount2= theDoc.menu.gam.value;

	for (var i=0;i<elementCount2;i++) {
		var oDeal2 = "gam"+i;
		if (oDeal2==divID) continue;
		theDoc.getElementById(oDeal2).style.display='none';
	}

	tabHitTest = new Array();
	for (var j=0; j<elementCount ; j++) {
		var oDeal = theName+j;
		tabHitTest[j] = theDoc.getElementById(oDeal);
		theDoc.getElementById(oDeal).style.overflow='hidden'; // remise à hidden de tous les div du niveau
	}

	if (parentdivID<500) {
		theDoc.getElementById('cat'+parentdivID+'').style.overflow='visible'; // pas d'overflow pour la div parent utilisée
		theDoc.getElementById('cat'+parentdivID+'').style.height = 'auto';
	}

	if (theDoc.getElementById(divID).style.display!="")
	{
		for (var i=0;i<elementCount;i++) {
			tabHitTest[i].style.display='none';
		}
		theDoc.getElementById(divID).style.display="";
		var divHeight = getElementStyle(divID, 'int', 'height' )["height"];
		maxi = divHeight; 
//alert(maxi);
//		if (navigator.platform.indexOf("Mac") != 0) {
			theDoc.getElementById(divID).style.height="1px";
			open_it(divID)
//		}
	}
}

var easing = 0.2; // constante d'amortissement
function open_it(name){
	var divname = name;
	var actualH = parseFloat(document.getElementById(divname).style.height);
	var dx = maxi - actualH;

	var newPos = Math.ceil(actualH+(easing*dx));

	document.getElementById(divname).style.height= newPos+"px";

	if (actualH!=maxi) {
		tempoO = setTimeout('open_it("'+divname+'")', 30);
	} else {
		clearTimeout(tempoO);
		return;
	}
}