<script type="text/javascript" src="js/ajax.js"></script>
<link rel="stylesheet" rev="stylesheet" href="incs/nlsmenu.css" type="text/css" />
<script type="text/javascript" src="js/nlsmenu.js"></script>
<script type="text/javascript" src="js/nlsmenueffect_1_2_1.js"></script>
<script type="text/javascript" src="js/catalog.js"></script>
<script type="text/javascript">
	var menuMgr = new NlsMenuManager("mgr");
	menuMgr.timeout = 500;
	menuMgr.flowOverFormElement = true;

	Request.progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
	var a_toolbar = new ToolBar();

	a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
				<inp2:m_if check="m_ParamEquals" name="is_catalog" value="1">
					active_selected = '';
					if (Grids[$Catalog.ActivePrefix]) {
						active_selected = Grids[$Catalog.ActivePrefix].GetSelected();
						set_hidden_field('selected_ids[' + $Catalog.ActivePrefix + ']', active_selected);
					}
					if (active_selected.length == 0) {
						var $category_ids = Grids['c'].GetSelected();
						if ($category_ids.length == 0) {
							// no categories selected, then use current category
							$category_ids = get_hidden_field('m_cat_id');
						}
						set_hidden_field('selected_ids[c]', $category_ids);
					}
				<inp2:m_else/>
					var $prefix = $Catalog.ActivePrefix.replace('.<inp2:m_get name="ts"/>', '');
					set_hidden_field('selected_ids[' + $prefix + ']', Grids[$Catalog.ActivePrefix].GetSelected());
				</inp2:m_if>

				submit_event('<inp2:m_Recall name="main_prefix"/>', 'OnProcessSelected');
			}
		) );
	a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
				window_close();
			}
	 	) );

	a_toolbar.AddButton( new ToolBarSeparator('sep1') );

	<inp2:m_if check="m_ParamEquals" name="is_catalog" value="1">
		a_toolbar.AddButton( new ToolBarButton('upcat', '<inp2:m_phrase label="la_ToolTip_Up" escape="1"/>', function() {
					$Catalog.go_to_cat($Catalog.ParentCategoryID);
				}
		 	) );

		a_toolbar.AddButton( new ToolBarButton('homecat', '<inp2:m_phrase label="la_ToolTip_Home" escape="1"/>', function() {
					$Catalog.go_to_cat(<inp2:c_HomeCategory/>);
				}
		 	) );
		a_toolbar.AddButton( new ToolBarSeparator('sep2') );
	</inp2:m_if>

	a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
				show_viewmenu(a_toolbar, 'view');
			}
	) );

	a_toolbar.Render();

	function edit()
	{

	}
</script>