	function ContextMenuModule(){
		this.Show = fncContextMenuShow;
		this.Hide = fncContextMenuHide;
		this.DisableBrowserMenu = fncContextMenuDisableBrowserMenu;
	}

	function fncContextMenuDisableBrowserMenu(){
		return false;
	}

	function fncContextMenuHide(){
		document.getElementById("ContextMenuContainer").style.visibility = "hidden";
	}

	function ParseName( XMLNode, state, hide )
	{
	
		var context = XMLNode.getAttribute("context");

		if ( context == null )
			return XMLNode.getAttribute(Ajour.LCID);
	
		if ( context == "hide" )
			return XMLNode.getAttribute(Ajour.LCID + '_' + hide)
		else
			return XMLNode.getAttribute(Ajour.LCID + '_' + state)
	}

	function fncContextMenuShow(me, e){
		
		if(document.getElementById("ContextMenuContainer")==null){
			alert('The object \'ContextMenuContainer\' could not be found. Context menues are disabled.')
			return false;
		}
		

		var State = me.getAttribute("state");
		var hide = me.getAttribute("hide");
		
		var str = new String;

		if(Ajour.Browser.firefox){

			var XMLNode = window.document.getElementsByTagName(me.getAttribute("Type"))[0];
			

			var i = 0; 
			var XMLChildNode; 

				ContextMenuObject = me;

				intX = e.clientX + document.body.scrollLeft;
				intY = e.clientY + document.body.scrollTop;
				
				document.getElementById("ContextMenuContainer").style.visibility = "visible";

				document.getElementById("ContextMenuContainer").style.left=intX-3;
				document.getElementById("ContextMenuContainer").style.top=intY-3;


				str += '<table style="padding: 1px 1px 1px 1px; background: #EFF0EB; border: 1px solid #666666;" width="140" border="0" cellpadding="0" cellspacing="0">';
				str += '	<tr>';
				str += '		<td>';
	   

				while(XMLNode.childNodes[i]){
					
					XMLChildNode = XMLNode.childNodes[i]; 
					if(XMLChildNode.nodeType==1){
						//if(XMLChildNode.getAttribute("onclick") != null){
						
						if (XMLChildNode.getAttribute("id")=="line"){
							str += '<div style="padding: 2px 0px 2px 0px;"><div style="border-top: 1px solid #999999;"></div></div>';
						}else{		
						
							str += '<div '
							str += 'onclick="' + XMLChildNode.getAttribute("onclick") + '" '
							str += 'style="border: 1px solid #EFF0EB; width:140px; cursor: pointer; padding: 5px 10px 5px 10px;" '
							str += 'onMouseOver="this.style.cursor=\'pointer\';this.style.padding=\'5px 10px 5px 10px\'; this.style.border=\'1px solid #666666\'; this.style.backgroundColor=\'#E1E3D0\'; document.getElementById(\'a' + XMLChildNode.getAttribute("id") + '\').style.color=\'#0E0D15\';" '
							str += 'onMouseOut="document.getElementById(\'a' + XMLChildNode.getAttribute("id") + '\').style.color=\'#0E0D15\'; this.style.backgroundColor=\'\'; this.style.border=\'1px solid #EFF0EB\'; this.style.padding=\'5px 10px 5px 10px\';">'
							str+= '<a ID="a' + XMLChildNode.getAttribute("id") + '" style="width:100%; color:black; text-decoration:none; font-size: 11px;">' + ParseName( XMLChildNode, State, hide ) + '</a>'
							str+= '</div>'; 
							//}
						}
					}
					i++;
				}

				str += '		</td>';
				str += '	</tr>';
				str += '</table>';

			document.getElementById("ContextMenuContainer").style.visibility = "visible";
			document.getElementById("ContextMenuContainer").innerHTML = str;

			return false;
		}
		
		if(!Ajour.Browser.firefox){
			XMLItems = contextMenu.documentElement.selectNodes("/root/" + me.getAttribute("Type") + "/item");

			//XMLItems = document.getElementById("contextMenu").getElementsByTagName("/root/" + me.getAttribute("Type") + "/item");


			if (XMLItems.length > 0) {

				ContextMenuObject = me;

				intX = event.clientX + document.body.scrollLeft;
				intY = event.clientY + document.body.scrollTop;
	
				document.getElementById("ContextMenuContainer").style.visibility = "visible";

				document.getElementById("ContextMenuContainer").style.pixelLeft=intX-3;
				document.getElementById("ContextMenuContainer").style.pixelTop=intY-3;

				str += '<table style="padding: 1px 1px 1px 1px; background: #EFF0EB; border: 1px solid #666666;" width="140" border="0" cellpadding="0" cellspacing="0">';
				str += '	<tr>';
				str += '		<td>';
	   
				for(var i=0;i<XMLItems.length;i++){
					XMLChildNode = XMLItems[i]
					
					//str += '<div onclick="' + Item.getAttribute("onclick") + '" style=""; cursor: pointer;" onMouseOver="this.style.backgroundColor=\'0a2a6a\';document.getElementById(\'a' + Item.getAttribute("id") + '\').style.color=\'FFFFFF\';" onMouseOut="document.getElementById(\'a' + Item.getAttribute("id") + '\').style.color=\'000000\';this.style.backgroundColor=\'\';"><a ID="a' + Item.getAttribute("id") + '" style="width:100%;color:black;text-decoration:none;text-align:left;border:none; font-size: 11px; height: 17px;">' + Item.getAttribute("id") + '</a></div>'; 
					
					if (XMLChildNode.getAttribute("id")=="line"){
						str += '<div style="padding: 2px 0px 2px 0px;"><div style="border-top: 1px solid #999999;"></div></div>';
						
					}else{
					
						str += '<div '
						str += 'onclick="' + XMLChildNode.getAttribute("onclick") + '" '
						str += 'style="z-index: 1; height: 23px; border: 1px solid #EFF0EB; width:100%; cursor: pointer; padding: 3px 10px 1px 10px;" '
						str += 'onMouseOver="this.style.cursor=\'pointer\';this.style.padding=\'3px 10px 1px 10px\'; this.style.border=\'1px solid #666666\'; this.style.backgroundColor=\'#E1E3D0\'; document.getElementById(\'a' + XMLChildNode.getAttribute("id") + '\').style.color=\'#0E0D15\';" '
						str += 'onMouseOut="document.getElementById(\'a' + XMLChildNode.getAttribute("id") + '\').style.color=\'#0E0D15\'; this.style.backgroundColor=\'\'; this.style.border=\'1px solid #EFF0EB\'; this.style.padding=\'3px 10px 1px 10px\';">'
						str+= '<a ID="a' + XMLChildNode.getAttribute("id") + '" style="width:100%; color:black; text-decoration:none; font-size: 11px;">' + ParseName( XMLChildNode, State, hide ) + '</a>'
						str+= '</div>'; 
					}
				}

				str += '		</td>';
				str += '	</tr>';
				str += '</table>';

			} else {

				document.getElementById("ContextMenuContainer").style.visibility = "hidden";

			}	
		
			document.getElementById("ContextMenuContainer").innerHTML = str;

			return false;
		}
	}
