public void encodeToHead(FacesContext facesContext, UIComponent component)
throws IOException {
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, facesContext);
Map<String, Object> options = AjaxRendererUtils.buildEventOptions(facesContext, component, true);
options.put("requestDelay", new JSReference("options.requestDelay"));
options.put("similarityGroupingId", new JSReference("options.similarityGroupingId || '" +
component.getClientId(facesContext) + "'"));
options.put("data", new JSReference("data"));
options.put("requestTime", new JSReference("options.requestTime"));
options.put("timeout", new JSReference("options.timeout"));
options.put("eventsQueue", new JSReference("options.eventsQueue"));
options.put("implicitEventsQueue", new JSReference("options.implicitEventsQueue"));
options.put("ignoreDupResponses", new JSReference("options.ignoreDupResponses"));
ajaxFunction.addParameter(options);
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.startElement(HTML.SCRIPT_ELEM, component);