{if $smarty.request.showExtendedToc}
	{assign var="start_id" value="0"}
	{assign var="show_root" value="true"}
{else}
	{assign var="start_id" value="1"}
{/if}
<script language="JavaScript">
{literal}
function editTarget(tocId)
{
	var winHeight = (preferredEditorHeight) ? preferredEditorHeight : 550;
	var winWidth = (preferredEditorWidth) ? preferredEditorWidth : 700;
	var options = '';
	
	options = 'height=' + winHeight + ',width=' + winWidth + ',top=' + ((screen.availHeight / 2) - (winHeight / 2)) + ',left=' + (screen.availWidth - winWidth - 25) + ',location=no,resizable=yes,toolbar=no,scrollbars=yes,status=yes';
	
	{/literal} 
	editWin = window.open('index.php?pg=pm/main&tocId='+tocId+'&newWindow=true', '{$vanity|replace:".":""}{$domain|replace:".":""}_editWindow', options);
	{literal} 
	editWin.focus();
	
	windowClosed = false;
}

function goTocLink(name, id) {
	var action = 'goto';
	var df = document.forms['tocLinks'];
	for (var x = 0; x < df.linkAction.length; x++)
		if (df.linkAction[x].checked)
			action = df.linkAction[x].value;
	if (action == 'goto')
		location.replace('./?pg='+name);
	else if (action == 'edit')
		editTarget(id);
}
{/literal}
</script>

<form name="tocLinks" style="margin:0px;">
<table border="0" align="center">
<tr><td>
	<div align="center">
		To build the entire Table of Contents for this site, <a href="./?pg=admin/toc/execute-build&doBuildToc=true">click here</a>.<br>
		(Building the Table of Contents may take a few moments, please be patient.)<br>
		<br>
	</div>
	<h2>The current Table of Contents: {if $start_id gt 0}<span> (<a href="./?pg={$page.name}&showExtendedToc=true">Click here</a> to see the extended TOC){/if}</span></h2>
	<div>
		Link action: <input type="radio" name="linkAction" value="goto" checked> Go To Page <input type="radio" name="linkAction" value="edit"> Edit Page<br>
		<br>
		{toc_display start_id=$start_id level_indent="&nbsp; &nbsp; &nbsp; &nbsp;" show_root=$show_root}
			{literal}
			{$toc_indent}<a href="javascript://" onclick="goTocLink('{$toc_pageName}', '{$toc_id}'); return false;" onmouseover="window.status='{$toc_description}'; return true;" onmouseout="window.status='';">{$toc_title}</a> (id:{$toc_id})<br>
			{/literal}
		{/toc_display}
	</div>
</td></tr>
</table>
</form>