	//------ Script Generated by SolpartWebControl -------//
	//------ Constants ------//
	var MOVE_MENU_MOVE_TYPE = "1";
	var MOVE_DIALOG_MOVE_TYPE = "2";
		
	//------ Member Variables ------//
			
	//-- Attributes --//
	
	var maOpenMenuID = new Array();	
	var miMoveType=null;
	var mbMouseDown=false;
	var m_objMenu = null;
	
	var fwDHFlag;
	
	var fwHideMenuTimer=null;
	//--------------- Event Functions ---------------//

	
	function mb_cH(e)
	{
		var objCell = e;
		var sID = objCell.id.substr(2);
		var objMenu = document.getElementById("tbl" + sID);
		if (objMenu != null)
		{
			if (objMenu.style.display == "block")
			{
				hideAllMenus();		
				showElement("SELECT");
			}
			else
			{
				positionMenuH(objMenu, objCell);
				objMenu.style.display = "block";
				maOpenMenuID[0] = sID;
				hideElement("SELECT",objMenu);
						
			}
		}
		e.bubbles = false;
		return false;
	}
	
	function showMenu_V()
	{
		FW_clearTimeout();
		hideAllMenus();
		mb_cV(this);
	}
	
	function showMenu_H(e)
	{
		FW_clearTimeout();
		hideAllMenus();
		mb_cVH(e);
	}
	
	function mb_cV(e)
	{
		var objCell = e;
		var sID = objCell.id.substr(2);
		var objMenu = document.getElementById("tbl" + sID);
		if (objMenu != null)
		{
			if (objMenu.style.display == "block")
			{
				hideAllMenus();		
				showElement("SELECT");
			}
			else
			{
				positionMenuV(objMenu, objCell);

				objMenu.style.display = "block";
				maOpenMenuID[0] = sID;
				hideElement("SELECT",objMenu);
						
			}
		}
		e.bubbles = false;
		return false;
	}
	
	function mb_cVH(e)
	{
		var objCell = e;
		var sID = objCell.id.substr(2);
		var objCellTD = document.getElementById("tt" + sID);	
		var objMenu = document.getElementById("tbl" + sID);
		if (objMenu != null)
		{
			//objMenu.style.display = "block";
			//objMenu.style.left = elementLeft(objCellTD);
			//objMenu.style.top = elementTop(objCellTD) + objCell.offsetHeight + 4;
			if (objMenu.style.display == "block")
			{
				hideAllMenus();
				showElement("SELECT");
			}
			else
			{
				positionMenuH(objMenu, objCellTD);
				objMenu.style.display = "block";
				maOpenMenuID[0] = sID;
				hideElement("SELECT",objMenu);
						
			}
		}
		e.bubbles = false;
		return false;
	}
	
	function mb_md(e)
	{
		var objCell = e;
		applyBorder(objCell, 1, SPM_SHADOWCOLOR, SPM_HIGHLIGHTCOLOR);
		
	}
	function mb_mu(e)
	{
		var objCell = e;
		applyBorder(objCell, 1, SPM_HIGHLIGHTCOLOR, SPM_SHADOWCOLOR);
	}

	function mb_moH(e)
	{
		var objCell = e;
		var sID = objCell.id.substr(2);
		var objMenu = document.getElementById("tbl" + sID);
		if (maOpenMenuID.length)
		{
			//--- if menu is shown then mouseover triggers the showing of all menus ---//
			hideAllMenus();
			if (objMenu != null)
			{		
				positionMenuH(objMenu, objCell);
				
				objMenu.style.display = "block";
				maOpenMenuID[0] = sID;
				hideElement("SELECT",objMenu);
			}	
			applyBorder(objCell, 1, SPM_SHADOWCOLOR, SPM_HIGHLIGHTCOLOR);
		}
		else
		{
			applyBorder(objCell, 1, SPM_HIGHLIGHTCOLOR, SPM_SHADOWCOLOR);
		}
	}

	function mb_moV(e)
	{
		var objCell = e;
		var sID = objCell.id.substr(2);
		var objMenu = document.getElementById("tbl" + sID);
		if (maOpenMenuID.length)
		{
			//--- if menu is shown then mouseover triggers the showing of all menus ---//
			hideAllMenus();
			if (objMenu != null)
			{		
				positionMenuV(objMenu, objCell);
				
				objMenu.style.display = "block";
				maOpenMenuID[0] = sID;
				hideElement("SELECT",objMenu);
			}		
			applyBorder(objCell, 1, SPM_SHADOWCOLOR, SPM_HIGHLIGHTCOLOR);
		}
		else
		{
			applyBorder(objCell, 1, SPM_HIGHLIGHTCOLOR, SPM_SHADOWCOLOR);
		}
	}

	function mb_mout(e)
	{
		var objCell = e;
		var sID = objCell.id.substr(2);

		applyBorder(objCell, 1, SPM_COLOR, SPM_COLOR, "none");	
	}

	function mbi_c(e)
	{
		var objRow = getSourceTR(e);
		var sID = objRow.id.substr(2);
		if (itemHasChildren(sID) == false)
		{		
			hideAllMenus();
		}
		return true;
		//window.event.cancelBubble = true;//
	}
	
	function FW_clearTimeout()
	{
		if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer);
		fwHideMenuTimer = null;
		fwDHFlag = false;
	}
	
	function FW_startTimeout()
	{
		fwStart = new Date();
		fwDHFlag = true;
		fwHideMenuTimer = setTimeout("hideAllMenus()", 500);
	}
	
	function fwDoHide()
	{
		if (!fwDHFlag) return;
		var elapsed = new Date() - fwStart;
		if (elapsed < 500) {
			fwHideMenuTimer = setTimeout("fwDoHide", 510-elapsed);
			return;
		}
		fwDHFlag = false;
		hideAllMenus();
		//window.ActiveMenuItem = 0;//
	}
	
	function mbi_mo(e)
	{		
		handlembi_mo(getSourceTR(e));
	}

	function mbi_mout(e)
	{	
		handlembi_mout(getSourceTR(e));
	}
	
	function OutSubMenu(e)
	{
		FW_startTimeout();
		mbi_moutsub(e);
	}
	
	function mbi_moutsub(e)
	{
		subhandlembi_mout(getSourceTR(e));
	}
	
	function subhandlembi_mout(objRow)
	{
			//var sID = objRow.id.substr(2);
			objRow.style.backgroundColor = SPM_COLOR_SUB;
			objRow.style.color = SPM_FORECOLOR;	
			//document.all["icon" + sID].style.backgroundColor = SPM_ICONBACKGROUNDCOLOR;
			//applyRowBorder(objRow, 1, "", false);
	}
		
	function OverSubMenu(e)
	{
		FW_clearTimeout();
		mbi_mo(e);
	}
	
		
	function menuhook_MouseMove(e) 
	{
		var iNewLeft=0, iNewTop = 0

		if (mbMouseDown) {
			hideAllMenus();
			
			if (m_objMenu.startLeft == null)
				m_objMenu.startLeft = m_objMenu.offsetLeft;

			iNewLeft=e.clientX - m_objMenu.startLeft - 3;
		      
			//if (iNewLeft&lt;0) //
			//	iNewLeft=0;//
			
			m_objMenu.style.left = iNewLeft;
					      
			if (m_objMenu.startTop == null)
				m_objMenu.startTop = m_objMenu.offsetTop;

			iNewTop=e.clientY - m_objMenu.startTop;
			//if (iNewTop&lt;0) //
			//	iNewTop=0;//
				
			m_objMenu.style.top = iNewTop - 10;

			miMoveType = MOVE_MENU_MOVE_TYPE;
		}
	}
	
	function menuhook_MouseDown(e)
	{
		mbMouseDown = true;
		m_objMenu = getElement(e, "tblMenuBar");
	}
	function menuhook_MouseUp(e)
	{
		mbMouseDown = false;
		m_objMenu = null;
	}
	
	function document_MouseMove(e)
	{
		switch(miMoveType)
		{
			case (MOVE_MENU_MOVE_TYPE):
			{
				menuhook_MouseMove(e);
				break;
			}
			case (MOVE_DIALOG_MOVE_TYPE):
			{
				dialoghook_MouseMove(e);
				break;
			}
		}
	}
	function document_MouseDown(e)
	{
		miMoveType = null;
	}
	
	function document_MouseUp(e)
	{
		miMoveType=null;
		mbMouseDown = false;		
	}

	function bodyclick(e)
	{
		hideAllMenus();
	}

	window.addEventListener("click", bodyclick, true);
	window.addEventListener("mousemove", document_MouseMove, true);
	window.addEventListener("mousedown", document_MouseDown, true);
	window.addEventListener("mouseup", document_MouseUp, true);

	//--------- Internal (private) Functions --------//
	
	function applyBorder(objCell, iSize, sTopLeftColor, sBottomRightColor, sStyle)
	{
		if (sStyle == null)
			sStyle = "solid";
			
		if (sTopLeftColor.length && sBottomRightColor.length)
		{
			objCell.style.borderTop = sStyle + " " + iSize + "px " + sTopLeftColor;
			objCell.style.borderLeft = sStyle + " " + iSize + "px " + sTopLeftColor;
			objCell.style.borderRight = sStyle + " " + iSize + "px " + sBottomRightColor;
			objCell.style.borderBottom = sStyle + " " + iSize + "px " + sBottomRightColor;	
		}
	}

	function applyRowBorder(objRow, iSize, sColor, bSelected, sStyle)
	{
		var sColor2=sColor;
		if (sStyle == null)
			sStyle = "solid";

		if (sColor == "")
		{
			if (bSelected)
				sColor2 = SPM_SELECTEDCOLOR;
			else
				sColor2 = objRow.cells[0].style.backgroundColor;
		}

		objRow.cells[0].style.borderLeft = sStyle + " " + iSize + "px " + sColor2;
		objRow.cells[0].style.borderTop = sStyle + " " + iSize + "px " + sColor2;
		objRow.cells[0].style.borderBottom = sStyle + " " + iSize + "px " + sColor2;

		if (sColor == "")
			sColor2 = objRow.style.backgroundColor;

		objRow.cells[1].style.borderTop = sStyle + " " + iSize + "px " + sColor2;
		objRow.cells[1].style.borderBottom = sStyle + " " + iSize + "px " + sColor2;

		//objRow.cells[2].style.borderRight = sStyle + " " + iSize + "px " + sColor2;//
		//objRow.cells[2].style.borderTop = sStyle + " " + iSize + "px " + sColor2;//
		//objRow.cells[2].style.borderBottom = sStyle + " " + iSize + "px " + sColor2;//
	}

	function getElement(e, sID) 
	{
		var o=e;
		var i=0;
		while (o.id != sID)
		{
			o=o.parentNode;
			i++;
		}
		return o;
	}
	
	function elementTop(eSrc)
	{
		var iTop = 0;
		var eParent;
			
		eParent = eSrc;
		
		while (eParent.tagName.toUpperCase() != "BODY")
		{
			iTop += eParent.offsetTop;
			eParent = eParent.offsetParent;
			if (eParent == null)
				break;
		}
		return iTop;
	}
	
	function elementLeft(eSrc)
	{	
		var iLeft = 0;
		var eParent;
			
		eParent = eSrc;
		
		while (eParent.tagName.toUpperCase() != "BODY")
		{
			iLeft += eParent.offsetLeft;

			eParent = eParent.offsetParent;
			if (eParent == null)
				break;
		}
		return iLeft;
	}

	function handleNewItemSelect(sID)
	{
		var i;
		var iNewLength=-1;
		var bDeleteRest=false; 

		for (i=0; i<maOpenMenuID.length; i++)
		{
			if (bDeleteRest)
			{
				if (document.getElementById("tbl" + maOpenMenuID[i]) != null)
				{
					document.getElementById("tbl" + maOpenMenuID[i]).style.display = "none";
				}
			}
						
			if (maOpenMenuID[i] == sID)
			{
				bDeleteRest=true;
				iNewLength = i;
			}				
		}
					
		if (iNewLength != -1)
			maOpenMenuID.length = iNewLength+1;
	}

	function hideAllMenus()
	{
		var i;
		for (i=0; i<maOpenMenuID.length; i++)
		{		
			if (document.getElementById("tbl" + maOpenMenuID[i]) != null)
			{
				document.getElementById("tbl" + maOpenMenuID[i]).style.display = "none";
			}
		}	
		maOpenMenuID.length = 0;
		showElement("SELECT");
	}	

	function FW_clearTimeout()
	{
		if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer);
		fwHideMenuTimer = null;
		fwDHFlag = false;
	}	
	function FW_startTimeout()
	{
		fwStart = new Date();
		fwDHFlag = true;
		//fwHideMenuTimer = setTimeout("fwDoHide()", 1000);
		fwHideMenuTimer = setTimeout("hideAllMenus()", 500);
	}

	function fwDoHide()
	{
		if (!fwDHFlag) return;
		var elapsed = new Date() - fwStart;
		if (elapsed < 1000) {
			fwHideMenuTimer = setTimeout("fwDoHide()", 1100-elapsed);
			return;
		}
		fwDHFlag = false;
		hideActiveMenus();
		window.ActiveMenuItem = 0;
	}
	
	function itemHasChildren(sID)
	{
		objTable = document.getElementById("tbl" + sID);
		if (objTable != null)
		{
			if (objTable.rows != null)
			{
				if (objTable.rows.length > 0)
					return true;
				else
					return false;
			}		
		}
	}
	
	function getSourceTR(e)
	{
		while (e.id == "")
		{
			e= e.parentElement;
		}

		if (e.id.indexOf("arrow") != -1)
		{
			var sID = e.id.substr(5);
			return document.getElementById("tr" + sID);
		}
		else if (e.id.indexOf("td") != -1)
		{
			var sID = e.id.substr(2);
			return document.getElementById("tr" + sID);
		}	
		else if (e.id.indexOf("icon") != -1)
		{
			var sID = e.id.substr(4);
			return document.getElementById("tr" + sID);
		}	
		else if (e.id.indexOf("img") != -1)
		{
			var sID = e.id.substr(3);
			return document.getElementById("tr" + sID);
		}	
		else
		{
			return e;
		}
	}

	function handlembi_mo(objRow)
	{
		/*var sID = objRow.id.substr(2);
		objRow.style.backgroundColor = SPM_SELECTEDCOLOR;
		objRow.style.color = SPM_SELECTEDFORECOLOR;
		applyRowBorder(objRow, 1, SPM_SELECTEDBORDERCOLOR, true);
		//document.getElementById("icon" + sID).style.backgroundColor = SPM_SELECTEDCOLOR;//
		handleNewItemSelect(objRow.getAttribute("parentID"));
		if (document.getElementById("tbl" + sID) != null)
		{
			var objMenu = document.getElementById("tbl" + sID);
			objMenu.style.left = elementLeft(objRow) + objRow.offsetWidth;
			objMenu.style.top = elementTop(objRow);

			objMenu.style.display = "block";
			window.status = elementLeft(objRow) + objRow.offsetWidth + objMenu.offsetWidth + ' - ' + window.innerWidth;
			if (elementLeft(objRow) + objRow.offsetWidth + objMenu.offsetWidth >= window.innerWidth)
			{
				objMenu.style.left = 0;	//--- NS6 reports offsetWidth of menu as only what shows on screen, not including how much is offscreen, so make sure its all on screen before using the offset ---//
				objMenu.style.left = elementLeft(objRow) - objMenu.offsetWidth;
				objMenu.style.top = elementTop(objRow);
			}
			maOpenMenuID[maOpenMenuID.length] = sID;
			hideElement("SELECT",objMenu);
		}	*/
		var sID = objRow.id.substr(2);
		objRow.style.backgroundColor = SPM_SELECTEDCOLOR;
		objRow.style.color = SPM_SELECTEDFORECOLOR;
		//document.all["icon" + sID].style.backgroundColor = SPM_SELECTEDCOLOR;
		//applyRowBorder(objRow, 1, SPM_SELECTEDBORDERCOLOR, true);
		if (maOpenMenuID.join(',').indexOf(objRow.id.replace('tr', '')) == -1)
		{

			handleNewItemSelect(objRow.parentID);			
			if (document.all["tr" + sID] != null)
			{
				objMenu = document.all["tr" + sID];

				objMenu.style.left = elementLeft(objRow) + objRow.offsetWidth;
				objMenu.style.top = elementTop(objRow);
				handleTransition(objMenu);
				objMenu.style.display = "";
				if (elementLeft(objRow) + objRow.offsetWidth + objMenu.offsetWidth > document.body.clientWidth)
				{
					objMenu.style.left = elementLeft(objRow) - objMenu.offsetWidth;
					objMenu.style.top = elementTop(objRow);					
				}
				maOpenMenuID[maOpenMenuID.length] = sID;
				hideElement("SELECT",objMenu);
			}	
		}
	}
	function handlembi_mout(objRow)
	{
		var sID = objRow.id.substr(2);
		objRow.style.backgroundColor = SPM_COLOR;
		objRow.style.color = SPM_FORECOLOR;	
		document.getElementById("icon" + sID).style.backgroundColor = SPM_ICONBACKGROUNDCOLOR;
		applyRowBorder(objRow, 1, "", false);
	}
	
	function positionMenuV(objMenu, objCell)
	{
		
		//position du sousmenu//
		//ancien code pour avoir le sousmenu positionné sur le bord droit du menu//
		objMenu.style.left = elementLeft(objCell) + objCell.offsetWidth + 4;
		//objMenu.style.left = elementLeft(objCell) + (objCell.offsetWidth/2);//
		objMenu.style.top = elementTop(objCell);
		
	}
	
	function positionMenuH(objMenu, objCell)
	{
		
		objMenu.style.left = elementLeft(objCell);
		objMenu.style.top = elementTop(objCell) + objCell.offsetHeight + 4;
		objMenu.style.display = "";
		if (elementLeft(objMenu) + objMenu.offsetWidth >= window.innerWidth)
		{
			objMenu.style.left = 0;
			objMenu.style.left = window.innerWidth - objMenu.offsetWidth;
			objMenu.style.top = elementTop(objCell) + objCell.offsetHeight;
		}
		objMenu.style.display = "none";	
	}
	
	function hideElement(elmID, eMenu)
	{
		var obj;
		//Hide any element that overlaps with the dropdown menu//
		for (i = 0; i < document.getElementsByTagName(elmID).length; i++)
		{
			obj = document.getElementsByTagName(elmID)[i];
			if (elementTop(obj) > parseInt(eMenu.style.top) + eMenu.offsetHeight)
			{
				//if element is below bottom of menu then do nothing//
			}
			else if (elementLeft(obj) > parseInt(eMenu.style.left) + eMenu.offsetWidth)
			{
				//if element is to the right of menu then do nothing//
			}
			else if (elementLeft(obj) + obj.offsetWidth < parseInt(eMenu.style.left))
			{
				//if element is to the left of menu then do nothing//
			}
			else if (elementTop(obj) + obj.offsetHeight < parseInt(eMenu.style.top))
			{
				//if element is to the top of menu then do nothing//
			}
			else
			{
				obj.style.visibility = "hidden";
			}
		}
	}
	function showElement(elmID)
	{
		// Display any element that was hidden//
		for (i = 0; i < document.getElementsByTagName(elmID).length; i++)
		{
			obj = document.getElementsByTagName(elmID)[i];
			if (! obj || ! obj.offsetParent)
				continue;
			obj.style.visibility = "";
		}
	}
	//------ End Script Generated by SolpartWebControl -------//
