attachContextMenuBuffer.append(attachContextMenuFunction.toScript());
} else {
if (isOnAvailable) {
JSFunction availableFunction = new JSFunction("Richfaces.onAvailable");
availableFunction.addParameter(clientId);
availableFunction.addParameter(new JSBind(attachContextMenuFunction, "contextMenu"));
attachContextMenuBuffer.append(availableFunction.toScript());
} else if (isOnLoad) {
JSFunction onloadFunction = new JSFunction("jQuery(document).ready");
onloadFunction.addParameter(new JSBind(attachContextMenuFunction, "contextMenu"));
attachContextMenuBuffer.append(onloadFunction.toScript());
}
}