
var actuListMenu = null;
var actuListMenuName = null;
function affListeProduit(branche)
{
	obj = document.getElementById(branche);
	if (actuListMenu != obj && actuListMenu != null) actuListMenu.className = "listeProduit";
	actuListMenu = obj;
	leStyle = obj.className;
	
	if(leStyle=="listeProduit")   obj.className = "listeProduit_deplie";
	else obj.className = "listeProduit";	
}	

function changeStyle(obj)
{
	if (actuListMenuName != obj && actuListMenuName != null) actuListMenuName.className = "libelle_branche";
	leStyle = obj.className;
	actuListMenuName = obj;
	if(leStyle=="libelle_branche")   obj.className = "libelle_branche_deplie";
	else obj.className = "libelle_branche";
}


/******************************************* System Screen Info *************************************************/

function scrollWinTo()
{
	if (scrollReg != getScrollWin() || widthReg != navWidth() || heightReg != navHeight())
	{
		scrollReg = getScrollWin();
		widthReg = navWidth();
		heightReg = navHeight();
	}
	
	if (div_elem_table)
	{
		try {
			var maxHeight = heightReg-100;
			var div_elem = div_elem_table.getElementsByTagName("div")[0];
			if (div_elem.style["height"] != undefined && div_elem.style["height"].length != 0)
			{
				isResizerdHeight = true;
				if (div_elem_table.offsetHeight < maxHeight) 
				{
					div_elem.style["height"] = "";
					div_elem_table.getElementsByTagName("td")[0].style["padding"] = "";
				}
			}
			
			if (div_elem_table.offsetHeight > maxHeight)
			{
				isResizerdHeight = true;
				if (div_elem.id.indexOf("_step") < 0) 
				{
					div_elem.style["height"] = maxHeight+"px";
					
					if (document.all)
					{
						
						if (!div_elem.style["width"]) 
						{
							div_elem.style["width"] = (div_elem.parentNode.offsetWidth)+"px";
						}
						div_elem_table.getElementsByTagName("td")[0].style["padding"] = "0px";
						//div_elem_table.getElementsByTagName("td")[0].style["padding"] = "5px 20px 5px 5px";
					}
				}
			}
			var subCont = document.getElementById("subContener");
			if (subCont && subCont.id)
			{
				if (subCont.offsetHeight+10 > maxHeight)
				{
					subCont.style["overflow"] = "";
					if (!div_elem_table.style["width"]) 
					{
						div_elem_table.style["width"] = (div_elem_table.offsetWidth-18)+"px";
					}
					
					subCont.style["height"] = (maxHeight)+"px";
				}
				else
				{
					subCont.style["height"] = "";
					subCont.style["overflow"] = "visible";
					div_elem_table.style["width"] = "";
				}
			}
		}
		catch (e) { }
	}
	
	if (calque_elem)
	{
		calque_elem.style["top"] = scrollReg+"px";
		calque_elem.style["width"] = widthReg+"px";
		calque_elem.style["height"] = heightReg+"px";
	}
	if (calque_elem2)
	{
		calque_elem2.style["top"] = scrollReg+"px";
		calque_elem2.style["width"] = widthReg+"px";
		calque_elem2.style["height"] = heightReg+"px";
	}
	if (win_elem && bloc_elem)
	{
		win_elem.style["left"] = ((widthReg-bloc_elem.offsetWidth)/2)+"px";
		win_elem.style["top"] = ((heightReg-bloc_elem.offsetHeight)/2)+scrollReg+"px";
	}
	/*
	try { window.pageYOffset = scrollReg; } catch (e) {} 
  	try { document.documentElement.scrollTop = scrollReg; } catch (e) {} 
	try { document.body.scrollTop = scrollReg; } catch (e) {} */
}

function getScrollWin()
{
	var val = 0;
	if (typeof window.pageYOffset != "undefined") val = window.pageYOffset;
	else if (typeof document.documentElement.scrollTop != "undefined") val = document.documentElement.scrollTop;
	else if (typeof document.body.scrollTop != "undefined") val = document.body.scrollTop;
	return val;
}

if (!document.all)
{
	var navWidth = function ()
	{
		try {
			if (window.innerWidth != 0) { 
				navWidth = function() { return window.innerWidth; };
				return window.innerWidth; 
			} 
		}
		catch (e) {}
		try {
			if (document.documentElement.clientWidth != 0) { 
				navWidth = function() { return document.documentElement.clientWidth; };
				return document.documentElement.clientWidth; } 
		}
		catch (e) {}
		try {
			if (window.document.body.clientWidth != 0) { 
				navWidth = function() { return window.document.body.clientWidth; }; 
				return window.document.body.clientWidth; 
			} 
		}
		catch (e) {}
		return 0;
	}
	
	
	var navHeight = function ()
	{
		try {
			if (window.innerHeight != 0) { 
				navHeight = function() { return window.innerHeight; };
				return window.innerHeight; 
			} 
		}
		catch (e) {}
		try {
			if (document.documentElement.clientHeight != 0) { 
				navHeight = function() { return document.documentElement.clientHeight; }; 
				return document.documentElement.clientHeight; 
			} 
		}
		catch (e) {}
		try {
			if (window.document.body.clientHeight != 0) { 
				navHeight = function() { return window.document.body.clientHeight; };
				return window.document.body.clientHeight;
			} 
		}
		catch (e) {}
		return 0;
	}
}
else
{
	var navWidth = function() { return (window.document.body.clientWidth); }
	var navHeight = function() { return (document.documentElement.clientHeight?document.documentElement.clientHeight:window.document.body.clientHeight); }
}

var scrollReg = 0;
var widthReg = 0;
var heightReg = 0;

var calque_elem = false;
var calque_elem2 = false;
var win_elem = false;
var bloc_elem = false;
var div_elem_table = false;

var scrollStat = false;
var isResizerdHeight = false;

var isIE5 = false;
var versionIE5 = 'MSIE 5.01';
if(navigator.appVersion.indexOf(versionIE5,0) > 0) isIE5 = true;

function showFilterBase()
{
	scrollStat = true;
	scrollReg = getScrollWin();
	var elem = document.createElement("div");
	var elem2 = document.createElement("div");
	
	
	elem.id = "elemFilter";
	elem2.id = "elemFilter2";
	
	elem.style["visibility"] = "hidden";
	elem2.style["visibility"] = "hidden";
	
	if(isIE5) elem.className = "floatDivIE5";
	else elem.className = "floatDiv";
	elem2.className = "floatDiv2";
	
	elem.style["position"] = "absolute";
	elem.style["width"] = navWidth()+"px";
	elem.style["height"] = navHeight()+"px";
	elem.style["top"] = getScrollWin()+"px";
	
	elem2.style["position"] = "absolute";
	elem2.style["width"] = navWidth()+"px";
	elem2.style["height"] = navHeight()+"px";
	elem2.style["top"] = getScrollWin()+"px";
	elem2["align"] = "center";
	
	var body = document.getElementsByTagName("body")[0];
	var bodyFirstElem = document.getElementsByTagName("a")[0];
	
	body.insertBefore(elem, bodyFirstElem);
	body.insertBefore(elem2, bodyFirstElem);
	
	scrollStat = window.setInterval("scrollWinTo()", 10);
	
	calque_elem = elem;
	calque_elem2 = elem2;
	
	window.setTimeout('document.getElementById("elemFilter").style["visibility"] = "";document.getElementById("elemFilter2").style["visibility"] = "";', 200);
}



function showFilter(id,largeur,notop,ext)
{
	if (typeof ext == "undefined") var ext = "px";
	scrollStat = true;
	scrollReg = getScrollWin();
	var elem = document.createElement("div");
	var box = document.createElement("div");
	elem.id = "elemFilter";
	box.id = "boxFilter";
	
	
	elem.style["visibility"] = "hidden";
	box.style["visibility"] = "hidden";
	
	if(isIE5) elem.className = "floatDivIE5";
	else elem.className = "floatDiv";
		
	box.style["position"] = "absolute";
	elem.style["position"] = "absolute";
	elem.style["width"] = navWidth()+"px";
	elem.style["height"] = navHeight()+"px";
	elem.style["top"] = getScrollWin()+"px";
	
	var body = document.getElementsByTagName("body")[0];
	var bodyFirstElem = document.getElementsByTagName("a")[0];
	body.insertBefore(elem, bodyFirstElem);
	
	scrollStat = window.setInterval("scrollWinTo()", 100);
	
	var mybloc = document.getElementById(id);
	mybloc.style["visibility"] = "hidden";
	
	box.className = "floatBox";
	
	body.insertBefore(box, bodyFirstElem);
	
	box.appendChild(mybloc);
	mybloc.style["position"] = "";
	mybloc.style["display"] = "block";
	mybloc.style["width"] = largeur+ext;
	mybloc.style["margin-top"] = getScrollWin()+"px";
	
	var maxHeight = navHeight()-100;
	try {
		div_elem_table = mybloc.getElementsByTagName("table")[1];
		if (div_elem_table.className == "calque_contenu_1")
		{
			var par = div_elem_table.parentNode;
			if (par.id == "ajaxContener")
			{
				var cont = document.createElement("div");
				cont.id = "subContener";
				par.insertBefore(cont,div_elem_table);
				cont.appendChild(div_elem_table);
			}
		}

		
		var div_elem = div_elem_table.getElementsByTagName("div")[0];
		if (div_elem_table.offsetHeight > maxHeight)
		{
			isResizerdHeight = true;
			div_elem.style["height"] = maxHeight+"px";
			if (document.all)
			{
				div_elem_table.getElementsByTagName("td")[0].style["padding"] = "5px 20px 5px 5px";
			}
		}
	}
	catch (e) { }
	
	box.style["left"] = ((navWidth()-mybloc.offsetWidth)/2)+"px";
	if(typeof notop == "undefined" || notop == null) box.style["top"] = ((navHeight()-mybloc.offsetHeight)/2)+scrollReg+"px";

	calque_elem = elem;
	win_elem = box;
	bloc_elem = mybloc;
	window.setTimeout('document.getElementById("elemFilter").style["visibility"] = "";document.getElementById("boxFilter").style["visibility"] = "";document.getElementById("'+id+'").style["visibility"] = "";', 200);
}


function hideFilter(id)
{
	window.clearInterval(scrollStat);
	var garbage = document.createElement("div");
	if (typeof id == "string")
	{
		if (isResizerdHeight == true)
		{
			isResizerdHeight = false;
			bloc_elem.style["height"] = "";
		}
		var mybloc = document.getElementById(id);
		var body = document.getElementsByTagName("body")[0];
		mybloc.style["display"] = "none";
		body.appendChild(mybloc);
	}
	else
	{
		garbage.appendChild(calque_elem2);
	}
	var elem = document.getElementById("elemFilter");
	var box = document.getElementById("boxFilter");
	
	
	garbage.appendChild(elem);
	garbage.appendChild(box);
	
	calque_elem = false;
	calque_elem2 = false;
	win_elem = false;
	bloc_elem = false;
	div_elem_table = false;
	if (id == "ajaxContener")
	{
			var newElem = document.createElement("div");
			try {newElem.appendChild(document.getElementById("ajaxContener"));newElem.innerHTML = "";} catch(e) {}
			hideSelect("contenerForm", true);
	}
}
