$result = $notification->returnNotification("warning", i18n('There is no Content Allocation tree.', 'content_allocation'));
} else {
    if (!is_object($tpl)) {
        $tpl = new Template();
    }
    $hiddenfields = '<input type="hidden" name="action" value="storeallocation">
		<input type="hidden" name="idart" value="' . $idart . '">
		<input type="hidden" name="contenido" value="' . $sess->id . '">
		<input type="hidden" name="area" value="' . $area . '">
		<input type="hidden" name="frame" value="' . $frame . '">
		<input type="hidden" name="idcat" value="' . $idcat . '">';
    $tpl->set('s', 'HIDDENFIELDS', $hiddenfields);
    if (sizeof($loadedAllocations) > 0) {
        $tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [' . implode(',', $loadedAllocations) . '];');
    } else {
        $tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [];');
    }
    $oDiv = new cHTMLDiv();
    $oDiv->updateAttributes(array('style' => 'text-align: right; padding: 5px; width: 730px; border: 1px #B3B3B3 solid; background-color: #FFFFFF;'));
    $oDiv->setContent('<input type="image" src="images/but_ok.gif" />');
    $tpl->set('s', 'DIV', '<br>' . $oDiv->render());
    $tpl->set('s', 'TREE', $result);
    $tpl->set('s', 'REMOVE_ALL', i18n("Remove all", 'content_allocation'));
    $tpl->set('s', 'REMOVE', i18n("Remove", 'content_allocation'));
    $result = $tpl->generate($cfg['pica']['treetemplate_complexlist'], true);
    $script = '<link rel="stylesheet" type="text/css" href="' . $cfg['pica']['style_complexlist'] . '"/>
	<script language="javascript" src="' . $cfg['pica']['script_complexlist'] . '"></script>';
    $oPage->addScript('style', $script);
}
$oPage->setContent($sLocationString . $result . markSubMenuItem(5, true));
$oPage->render();
		</tr>
		</form>
		</table>
		<script language="JavaScript">
			controller = document.getElementById("itemname");
			controller.focus();
			function fieldCheck() {
				if (controller.value == "") {
					alert("' . i18n("Please enter a category name.", 'content_allocation') . '");
					controller.focus();
					return false;
				}
                return true;
			}
		</script>';
    $oDiv->setContent($form);
    $sTemp = $oDiv->render();
} else {
    $newTree = '<a href="main.php?action=' . $action . '&step=createRoot&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img  src="images/folder_new.gif" border="0" style="vertical-align: middle; margin-right: 5px;">' . i18n("Create new tree", 'content_allocation') . '</a><div style="height:10px"></div>';
}
$result = $oTree->renderTree(true);
if ($result === false) {
    $result = '&nbsp;';
}
$js = '
<script language="javascript">
/* Function for deleting categories*/
function deleteCategory(idpica_alloc) {
    var url = "main.php?area=' . $area . '&action=' . $action . '&step=deleteItem&idpica_alloc=" + idpica_alloc + "&frame=' . $frame . '&contenido=' . $sess->id . '";
    window.location.href = url;
}