{if $close}
<script>
{if $reload}window.opener.location.reload();{/if}
window.close();
</script>
{else}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="description" content="description"/>
		<meta name="keywords" content="keywords"/>
		<meta name="author" content="author"/>
		<link rel="stylesheet" type="text/css" href="/skins/default/css/all.css" />
		<title>Редактирование узла</title>
	</head>
<body style="width:468px;">
<div id="body" style="width:468px">
	<form action="{url var1=$tree_id}" method="post" id="change_form" onsubmit="return check_form()">
		<table border="0" id="allStrings">
			<tr>
				<td>id</td>
				<td>{$tree_id}</td>
			</tr>
			<tr>
				<td>Название*</td>
				<td>
					<input type="hidden" name="token" value="{$_user->token}" />
					<input name="tree_id" type="hidden" value="{$tree_id}" />
					<input class="simple" name="tree_name" type="text" value="{$tree_name|escape}" size="30" /> 
				</td>
			</tr>
			<tr>
				<td style="vertical-align:top;">Путь</td>
				<td>
					<input class="simple" type="text" name="path" value="{$tree_path|escape}" size="30" />
					<br /><input type="checkbox" name="external"{if $external} checked="checked"{/if} />
					<span style="font-size: 11px;">Оставить путь без преобразований</span>
				</td>
			</tr>
			<tr>
				<td>Родитель</td>
				<td>
					<select name="parent" style="width:200px">
						<option value="0">&nbsp;</option>
						{html_options options=$parent_select selected=$parent_id_sel}
					</select>
				</td>
			</tr>
			<tr>
				<td>Ссылка на</td>
				<td>
					<select name="symlink" id="symlink" onchange="change_view(this)" style="width:200px">
						<option value="0">&nbsp;</option>
						{html_options options=$symlink_select selected=$symlink_current}
					</select>
				</td>
			</tr>
			<tr class="additional">
				<td>Шаблон</td>
				<td>
					<select name="template" style="width:200px">
						<option value="">&nbsp;</option>
						{html_options options=$templates selected=$cur_template}
					</select>
				</td>
			</tr>
			<tr class="additional">
				<td>Параметры</td>
				<td>
					<input class="simple" name="params" type="text" value="{$params|escape}" size="30" />
				</td>
			</tr>
			{if count($langs)>1}
			<tr class="additional">
				<td>Язык</td>
				<td>
					<select name="lang_id" style="width:200px">
						<option value="">&nbsp;</option>
						{html_options options=$langs selected=$lang_id}
					</select>
				</td>
			</tr>
			{/if}
			<tr class="additional">
				<td>Модули</td>
				<td>
					<div style="width:100%; height:380px; overflow:auto">
						{foreach $modules_list as $module}
						<input class="simple" type="checkbox" name="module[{$module.id}]" {if $module.checked} checked="checked"{/if} {if $module.component_js}onclick="check_component(this)"{/if} /> {$module.name|escape} {if $module.component_js}<img src="/skins/default/images/icons/simple_component.png" class="icon" title="компонент" alt="компонент" />{/if}
						{if $module.static}<img src="/skins/default/images/icons/simple_static.png" class="icon" title="статичный" alt="статичный" />{/if} <br />
						{/foreach}
					</div>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<input type="submit" style="width:100%;" value="Сохранить" />
				</td>
			</tr>
		</table>
	</form>
</div>
<script type="text/javascript">
	{literal}
	function mark_modules()
	{
		var i=0;
		while ($('change_form').elements[i])
		{
			if ($('change_form').elements[i].name.substr(0, 6)=='module' && $('change_form').elements[i].disabled && $('change_form').elements[i].checked) 
			{
				$('change_form').elements[i].checked=false;
				$('change_form').elements[i].disabled=false;
			}
			i++;
		}
	}

	function check_component(current)
	{
		var i=0;
		component=new Array({/literal}{$component}{literal});
		if (current)
		while ($('change_form').elements[i])
		{
			for (var j=0; j < component.length; j++)
			{
				if ($('change_form').elements[i].name=='module['+component[j]+']' && $('change_form').elements[i].checked==false)
				{
					$('change_form').elements[i].disabled=(current.checked) ? "disabled" : false;
				}
			}
			i++;
		}
	}

	function check_form()
	{
		var error="";
		if ($('change_form').tree_name.value=="") error=error+"Введите название страницы\n";
		//if ($('change_form').path.value=="") error=error+"Введите путь (URL)\n";
		var i=0;
		var checkbox=false;
		while ($('change_form').elements[i])
		{
			if ($('change_form').elements[i].name.substr(0, 6)=='module' && $('change_form').elements[i].checked==true) checkbox=true;
			i++;
		}
		//if (!checkbox) error=error+"Выберите модули\n";

		if (error)
		{
			alert(error);
			return false;
		}
	}
	
	function $(item)
	{
		return document.getElementById(item);
	}
	
	function change_view(elmnt)
	{
		/*strings=$('allStrings').getElementsByTagName('tr');
		for(i=0; i < strings.length; i++)
		{
			if (strings[i].className=='additional')
				strings[i].style.display=(elmnt.value>0)?'none':'';
		}*/
	}
	
	{/literal}
	mark_modules();
	change_view($('symlink'));
	check_component($('change_form')['module[{$imp_module_id}]']);
</script>
</body>
</html>	
{/if}
