	ns4 = (document.layers)? true:false
	ie4 = (document.all)? true:false
	ns6 = (!document.all && document.getElementById)? true:false
	mac = (document.all && document.getElementById)? true:false
	var WinLexFieldId = null
	var WinLexFieldName = null
	var WinLexToHide=0;
	var WinLexShow=false;
	var WinLexOldName="";
	var WinLexOldTabIndex="";
	function WinLexLayerWrite(obj, txt) 
		{
		Mes = "document.layers="+document.layers+unescape("%0D")
		Mes+= "document.all="+document.all+unescape("%0D")
		Mes+= "document.getElementById="+document.getElementById+unescape("%0D")
//		alert(Mes)
		if (ns4)
			{
//			alert("ns4")
			var lyr = eval("document."+obj+".document")
			lyr.write(txt)
   			lyr.close()
 			}
		else if (ie4) 
			{
			document.getElementById(obj).innerHTML = txt
			}
		else if (ns6) 
			{
			document.getElementById(obj).innerHTML = txt
			}
		}
	function	LexMouseOver(FieldId, FieldName, Lex, TabIndex, event, x, y, Toggle)
		{
		if (!LexMouseOverOpen(Lex, TabIndex, Toggle))
			return;
		if (x==-1)
			x=154
		if (y==-1)
			{
			y=103
			if (TabIndex!="")
				y+=(TabIndex * 23)
			}
		LexMouseOverClose(FieldId, FieldName, Lex, TabIndex, x, y, 334, -1)
		WinLexToHide=1;
		}
	function	LexMouseOverOpen(Lex, TabIndex, Toggle)
		{
		if (Toggle==true && WinLexShow==true)
			{
			HideLex();
			return false;
			}
		if (WinLexToHide==1)
			{
			if (Lex==0 || (Lex==WinLexOldName && TabIndex==WinLexOldTabIndex))
				{
				WinLexToHide=0
				return false
				}
			}
		return true
		}
	function	LexMouseOverClose(FieldId, FieldName, Lex, TabIndex, x, y, deltaX, deltaY)
		{
		topMenu=(y) 
		leftMenu=(x)
		if (ie4) 
			{
			if (topMenu<document.body.scrollTop+10)
				topMenu=document.body.scrollTop+10
			if (leftMenu<document.body.scrollLeft+10)
				leftMenu=document.body.scrollLeft+10
			}
		idWinLex = document.getElementById("WinLex"+Lex);
		idWinLex.style.top=topMenu
		if (x!=-1)
			idWinLex.style.left=leftMenu
		if (deltaX!=-1)
			idWinLex.style.width=deltaX
		if (deltaY!=-1)
			idWinLex.style.height=deltaY

		idWinLexOmbre= document.getElementById("WinLexOmbre");
		idWinLexOmbre.style.top=topMenu+5
		if (x!=-1)
			idWinLexOmbre.style.left=leftMenu+5
		if (deltaX!=-1)
			idWinLexOmbre.style.width=deltaX
		if (deltaY!=-1)
			idWinLexOmbre.style.height=deltaY

		FieldLex = document.getElementById("Lex"+Lex);
		idWinLex.style.visibility="visible";
		FieldLex.focus();
		for(iOpt=0; iOpt<FieldLex.options.length; iOpt++)
			{
			if (FieldLex.options[iOpt].value==FieldName.value)
				{
				FieldLex.options[iOpt].selected=true;
				}
			}
		if (iOpt=FieldLex.options.length)
			FieldLex.options[0].selected=true;
			
		WinLexFieldId = FieldId
		WinLexFieldName = FieldName
		WinLexOldName = Lex
		WinLexOldTabIndex = TabIndex
		WinLexToHide=0
		WinLexShow=true;
		}
	function LexMouseOut()
		{	
		if (WinLexToHide==0)
			{
			WinLexToHide=1
			setTimeout("HideLex()",250)
			}
		}
	function HideLex()
		{	
		if (WinLexToHide==1 && WinLexOldName!="")
			{
			document.getElementById("WinLex"+WinLexOldName).style.visibility = "hidden"
			document.getElementById("WinLexOmbre").style.visibility = "hidden"

//			alert(WinLexOldName)
			WinLexShow=false;
			WinLexFieldId = null
			WinLexFieldName = null
			WinLexOldName =""
			WinLexOldTabIndex = ""
			WinLexToHide=0
			}
		}
	function LexSelectItem(Id, Value)
		{
		LexOldName = WinLexOldName
		LexOldTabIndex = WinLexOldTabIndex
		LexFieldId = WinLexFieldId
		LexFieldName = WinLexFieldName
		WinLexToHide=1
		
		LexSelect(LexOldName, LexOldTabIndex, LexFieldId, LexFieldName, Id, Value, -1)
		HideLex();
		}

