<?xml version="1.0" encoding="UTF-8"?>
<f:root 
	xmlns:f="http://ajax4jsf.org/cdk/template" 
	xmlns:c=" http://java.sun.com/jsf/core" 
	xmlns:ui=" http://ajax4jsf.org/cdk/ui"
	xmlns:u=" http://ajax4jsf.org/cdk/u"
	xmlns:x=" http://ajax4jsf.org/cdk/x"
	baseclass="org.richfaces.renderkit.html.MenuItemRendererBase"
	class="org.richfaces.renderkit.html.MenuItemRenderer"
	component="org.richfaces.component.UIMenuItem" 
	>
	<h:styles>css/menucomponents.xcss</h:styles>  
	
   	<h:scripts>
			new org.ajax4jsf.javascript.PrototypeScript(),
			new org.ajax4jsf.javascript.AjaxScript(),
			/org/richfaces/renderkit/html/scripts/utils.js,
			/org/ajax4jsf/javascript/scripts/form.js,
			/org/richfaces/renderkit/html/scripts/form.js
	</h:scripts>

    <jsp:scriptlet>
		<![CDATA[
		         String mode = ((org.richfaces.component.UIMenuItem)component).getSubmitMode();
		         if (mode != null && !mode.equalsIgnoreCase("none")) org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);
		]]>		                                               
    </jsp:scriptlet>	
	
	<f:call name="initializeResources" />
	
	<f:clientid var="clientId"/>
			
		
	<jsp:scriptlet><![CDATA[
			if (((org.richfaces.component.UIMenuItem) component).isDisabled()) {
	]]></jsp:scriptlet>	
			
	<div id="#{clientId}" 		
		class="dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled #{component.attributes['styleClass']}"
		style="#{component.attributes['style']}"
		onclick="Event.stop(event || window.event);">
		
	<jsp:scriptlet><![CDATA[
		} else {
	]]></jsp:scriptlet>
	
	<div id="#{clientId}" 
		class="dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled #{component.attributes['styleClass']}" 		
		style="#{component.attributes['style']}"
		onclick="#{component.attributes['onselect']}; #{onclick}">		
		<f:call name="utils.encodeAttributes">
			<f:parameter value="onmousedown,onmouseup,onmousemove" />
		</f:call>
		
	<jsp:scriptlet><![CDATA[
		}
	]]></jsp:scriptlet>
		
		
		<span id="#{clientId}:icon" 
			class="dr-menu-icon rich-menu-item-icon #{iconDisabledClasses} #{component.attributes['iconClass']}"
			style="#{component.attributes['iconStyle']}">
			
			<jsp:scriptlet><![CDATA[
				UIComponent iconFacet = getIconFacet((org.richfaces.component.UIMenuItem) component);			
				if (null != iconFacet) {
					renderChild(context, iconFacet);	
				} else {
			]]></jsp:scriptlet>
			
			<img width="16" 
				height="16"				
				src="#{icon}" />
				
			<jsp:scriptlet><![CDATA[
				}
			]]></jsp:scriptlet>
			
		</span>
		
		<span id="#{clientId}:anchor"			
			class="#{menuItemLabelClass}"
			>
			#{component.attributes['value']}
			<f:call name="renderChildren" />
		</span>

	<jsp:scriptlet><![CDATA[
		if (((org.richfaces.component.UIMenuItem) component).isDisabled()) {
	]]></jsp:scriptlet>	
	</div>
	<jsp:scriptlet><![CDATA[
		} else {
	]]></jsp:scriptlet>
	</div>
	<jsp:scriptlet><![CDATA[
		}
	]]></jsp:scriptlet>
</f:root>