if(component instanceof UIPanelBar){
UIPanelBar panelBar = (UIPanelBar)component;
List<?> items = getScriptPanelBarItems(context, panelBar);
ScriptOptions options = new ScriptOptions(component);
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
addHandlerOption(panelBar, options, "onitemchange");
addHandlerOption(panelBar, options, "onitemchanged");
options.addOption("onclick", panelBar.getAttributes().get("onclick"));
options.addOption("mouseover", panelBar.getAttributes().get("onmouseover"));
options.addOption("mouseout", panelBar.getAttributes().get("onmouseout"));
options.addOption("mousemove", panelBar.getAttributes().get("onmousemove"));
options.addOption("items", items);
options.addOption("ajax", ajaxContext.isAjaxRequest());
StringBuffer script = new StringBuffer();
JSFunction function = new JSFunction("new Richfaces.PanelBar");
function.addParameter(panelBar.getClientId(context));