Index: branches/5.0.x/core/units/helpers/category_helper.php
===================================================================
--- branches/5.0.x/core/units/helpers/category_helper.php	(revision 12458)
+++ branches/5.0.x/core/units/helpers/category_helper.php	(revision 12459)
@@ -1,498 +1,502 @@
 <?php
 /**
 * @version	$Id$
 * @package	In-Portal
 * @copyright	Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
 * @license      GNU/GPL
 * In-Portal is Open Source software.
 * This means that this software may have been modified pursuant
 * the GNU General Public License, and as distributed it includes
 * or is derivative of works licensed under the GNU General Public License
 * or other free or open source software licenses.
 * See http://www.in-portal.net/license/ for copyright notices and details.
 */
 
 	defined('FULL_PATH') or die('restricted access!');
 
 	class CategoryHelper extends kHelper {
 
 		/**
 		 * Structure tree for ParentId field in category or category items
 		 *
 		 * @var Array
 		 */
 		var $_structureTree = null;
 
 		/**
 		 * Prints category path using given blocks. Also supports used defined path elements at the end.
 		 *
 		 * @param Array $params
 		 * @return string
 		 */
 		function NavigationBar($params)
 		{
 			$params['is_first'] = 1;
 			$main_category_id = isset($params['cat_id']) ? $params['cat_id'] : $this->Application->GetVar('m_cat_id');
 
 			if (array_key_exists('shift', $params) && $params['shift']) {
 				$home_element = '';
 				$params['shift']--;
 			}
 			else {
 				$home_element = $this->getHomeCategoryPath($params, $main_category_id);
 				unset($params['is_first']);
 			}
 
 			if (!getArrayValue($params, 'titles') && !getArrayValue($params, 'templates')) {
 				// no static templates given, show only category path
 				return $home_element . $this->getCategoryPath($main_category_id, $params);
 			}
 
 			$navigation_parts = $this->getNavigationParts($params['titles'], $params['templates']);
 
 			$ret = '';
 			$block_params = Array (); //$params; // sort of TagProcessor:prepareTagParams
 			$block_params['no_editing'] = 1;
 			$block_params['category'] = 0;
 			$block_params['separator'] = $params['separator'];
 			$current_template = $this->Application->GetVar('t');
 			$show_category = getArrayValue($params, 'show_category');
 
 			foreach ($navigation_parts as $template => $title) {
 				$block_params['template'] = $template;
 
 				if ($title == '__item__') {
 					if ($show_category) {
 						$ret .= $this->getCategoryPath($main_category_id, $params);
 						$show_category = false;
 					}
 
 					$category_path = $this->getCategoryParentPath($main_category_id);
 					$module_info = $this->getCategoryModule($params, array_keys($category_path));
 					if (!$module_info) {
 						continue;
 					}
 
 					$module_prefix = $module_info['Var'];
 					$object =& $this->Application->recallObject($module_prefix);
 					/* @var $object kCatDBItem */
 
 					$title_field = $this->Application->getUnitOption($module_prefix, 'TitleField');
 					$block_params['title'] = $object->GetField($title_field);
 					$block_params['prefix'] = $module_prefix;
 					$block_params['current'] = 0;
 
 					$block_params['name'] = $this->SelectParam($params, 'module_item_render_as,render_as');
 				}
 				else {
 					$block_params['current'] = ($template == $current_template);
 					$block_params['title'] = $this->Application->Phrase($title);
 
 					$block_params['name'] = $template == $current_template ? $params['current_render_as'] : $params['render_as'];
 				}
 
 				$ret .= $this->Application->ParseBlock($block_params);
 			}
 
 			if ($show_category) {
 				$params['no_current'] = true;
 				return $home_element . ($show_category ? $this->getCategoryPath($main_category_id, $params) : '') . $ret;
 			}
 
 			return $home_element . $ret;
 		}
 
 		/**
 		 * Get navigation parts
 		 *
 		 * @param Array $titles
 		 * @param Array $templates
 		 * @return Array
 		 */
 		function getNavigationParts($titles, $templates)
 		{
 			$titles = explode(',', $titles);
 			$templates = explode(',', $templates);
 
 			$ret = Array ();
 			foreach ($templates as $template_pos => $template) {
 				$ret[$template] = $titles[$template_pos];
 			}
 
 			return $ret;
 		}
 
 		/**
 		 * Renders path to given category using given blocks.
 		 *
 		 * @param int $main_category_id
 		 * @param Array $params
 		 * @return string
 		 */
 		function getCategoryPath($main_category_id, $params)
 		{
 			$category_path = $this->getCategoryParentPath($main_category_id);
 			if (!$category_path) {
 				// in "Home" category
 				return '';
 			}
 
 			if (array_key_exists('shift', $params) && $params['shift']) {
 				array_splice($category_path, 0, $params['shift']);
 			}
 
 			$module_info = $this->getCategoryModule($params, array_keys($category_path));
 
 			$module_category_id = $module_info['RootCat'];
 			$module_item_id = $this->Application->GetVar($module_info['Var'].'_id');
 
 			$ret = '';
 			$block_params['category'] = 1;
 			$block_params['no_editing'] = 1;
-			$block_params['is_first'] = $params['is_first'];
+
+			if (array_key_exists('is_first', $params)) {
+				$block_params['is_first'] = $params['is_first'];
+			}
+
 			$block_params['separator'] = $params['separator'];
 			$no_current = isset($params['no_current']) && $params['no_current'];
 
 			$backup_category_id = $this->Application->GetVar('c_id');
 			foreach ($category_path as $category_id => $category_name) {
 				$block_params['cat_id'] = $category_id;
 				$block_params['cat_name'] = $block_params['title'] = $category_name;
 
 				if ($no_current) {
 					$block_params['current'] = 0;
 				}
 				else {
 					$block_params['current'] = ($main_category_id == $category_id) && !$module_item_id ? 1 : 0;
 				}
 
 				$block_params['is_module_root'] = $category_id == $module_category_id ? 1 : 0;
 				$block_params['name'] = $this->SelectParam($params, 'render_as,block');
 
 				// which block to parse as current ?
 				if ($block_params['is_module_root']) {
 					$block_params['name'] = $this->SelectParam($params, 'module_root_render_as,render_as');
 					$block_params['module_index'] = $module_info['TemplatePath'].'index';
 				}
 
 				if ($block_params['current']) {
 					$block_params['name'] = $this->SelectParam($params, 'current_render_as,render_as');
 				}
 
 				$this->Application->SetVar('c_id', $category_id);
 				$ret .= $this->Application->ParseBlock($block_params);
 
 				if (array_key_exists('is_first', $block_params)) {
 					unset($block_params['is_first']);
 				}
 			}
 
 			$this->Application->SetVar('c_id', $backup_category_id);
 
 			return $ret;
 		}
 
 		/**
 		 * Returns module information based on given module name or current category (relative to module root categories)
 		 *
 		 * @param Array $params
 		 * @param Array $category_ids category parent path (already as array)
 		 * @return Array
 		 */
 		function getCategoryModule($params, $category_ids)
 		{
 			if (isset($params['module'])) {
 				// get module by name specified
 				$module_info = $this->Application->findModule('Name', $params['module']);
 
 			}
 			elseif ($category_ids) {
 				// get module by category path
 				$module_root_categories = $this->getModuleRootCategories();
 				$common_categories = array_intersect($category_ids, $module_root_categories);
 				$module_category_id = array_shift($common_categories); // get 1st common category
 				$module_info = $this->Application->findModule('RootCat', $module_category_id);
 			}
 
 			return $module_info;
 		}
 
 		/**
 		 * Renders path to top catalog category
 		 *
 		 * @param Array $params
 		 * @param int $current_category
 		 * @return string
 		 */
 		function getHomeCategoryPath($params, $current_category)
 		{
 			$block_params['cat_id'] = $this->Application->findModule('Name', 'Core', 'RootCat'); // 0;
 			$block_params['no_editing'] = 1;
 			$block_params['current'] = $current_category == $block_params['cat_id'] ? 1 : 0;
 			$block_params['separator'] = $params['separator'];
 			$block_params['is_first'] = $params['is_first'];
 			$block_params['cat_name'] = $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params);
 			$block_params['name'] = $this->SelectParam($params, 'root_cat_render_as,render_as');
 
 			return $this->Application->ParseBlock($block_params);
 		}
 
 		/**
 		 * Returns root categories from all modules
 		 *
 		 * @return Array
 		 */
 		function getModuleRootCategories()
 		{
 			static $root_categories = null;
 
 			if (!isset($root_categories)) {
 				$root_categories = Array ();
 				foreach ($this->Application->ModuleInfo as $module_name => $module_info) {
 					array_push($root_categories, $module_info['RootCat']);
 				}
 
 				$root_categories = array_unique($root_categories);
 			}
 
 			return $root_categories;
 		}
 
 		/**
 		 * Returns given category's parent path as array of id=>name elements
 		 *
 		 * @param int $main_category_id
 		 * @return Array
 		 */
 		function getCategoryParentPath($main_category_id)
 		{
 			static $cached_path = null;
 
 			if ($main_category_id == 0) {
 				// don't query path for "Home" category
 				return Array ();
 			}
 
 			if (!isset($cached_path[$main_category_id])) {
 				$ml_formatter =& $this->Application->recallObject('kMultiLanguage');
 				$navbar_field = $ml_formatter->LangFieldName('CachedNavBar');
 
 				$id_field = $this->Application->getUnitOption('c', 'IDField');
 				$table_name = $this->Application->getUnitOption('c', 'TableName');
 
 				$sql = 'SELECT '.$navbar_field.', ParentPath
 						FROM '.$table_name.'
 						WHERE '.$id_field.' = '.$main_category_id;
 				$category_data = $this->Conn->GetRow($sql);
 
 				$skip_category = $this->Application->findModule('Name', 'Core', 'RootCat');
 				$cached_path[$main_category_id] = Array ();
 				if ($category_data) {
 					$category_names = explode('&|&', $category_data[$navbar_field]);
 					$category_ids = explode('|', substr($category_data['ParentPath'], 1, -1));
 
 					foreach ($category_ids as $category_index => $category_id) {
 						if ($category_id == $skip_category) {
 							continue;
 						}
 						$cached_path[$main_category_id][$category_id] = $category_names[$category_index];
 					}
 				}
 			}
 			return $cached_path[$main_category_id];
 		}
 
 		 /**
 		 * Not tag, method for parameter
 		 * selection from list in this TagProcessor
 		 *
 		 * @param Array $params
 		 * @param string $possible_names
 		 * @return string
 		 * @access public
 		 */
 		function SelectParam($params, $possible_names)
 		{
 			if (!is_array($params)) return;
 			if (!is_array($possible_names))
 
 			$possible_names = explode(',', $possible_names);
 			foreach ($possible_names as $name)
 			{
 				if( isset($params[$name]) ) return $params[$name];
 			}
 			return false;
 		}
 
 		/**
 		 * Converts multi-dimensional category structure in one-dimensional option array (category_id=>category_name)
 		 *
 		 * @param Array $data
 		 * @param int $parent_category_id
 		 * @param int_type $language_id
 		 * @param int $theme_id
 		 * @param int $level
 		 * @return Array
 		 */
 		function _printChildren(&$data, $parent_category_id, $language_id, $theme_id, $level = 0)
 		{
 			if ($data['ThemeId'] != $theme_id && $data['ThemeId'] != 0) {
 				// don't show system templates from different themes
 				return Array ();
 			}
 
 			$ret = Array($parent_category_id => str_repeat('-', $level).' '.$data['l'.$language_id.'_Name']);
 
 			if ($data['children']) {
 				$level++;
 				foreach ($data['children'] as $category_id => $category_data) {
 					$ret = array_merge_recursive2($ret, $this->_printChildren($data['children'][$category_id], $category_id, $language_id, $theme_id, $level));
 				}
 			}
 
 			return $ret;
 		}
 
 		/**
 		 * Returns information about children under parent path (recursive)
 		 *
 		 * @param int $parent_category_id
 		 * @param int $language_count
 		 * @return Array
 		 */
 		function _getChildren($parent_category_id, $language_count)
 		{
 			$id_field = $this->Application->getUnitOption('c', 'IDField');
 
 			// get category children + parent category
 			$sql = 'SELECT *
 					FROM '.$this->Application->getUnitOption('c', 'TableName').'
 					WHERE ParentId = '.$parent_category_id.' OR '.$id_field.' = '.$parent_category_id.'
 					ORDER BY Priority DESC';
 			$categories = $this->Conn->Query($sql, $id_field);
 
 			$parent_data = $categories[$parent_category_id];
 			unset($categories[$parent_category_id]);
 
 			// no children for this category
 			$data = Array ('id' => $parent_data[$id_field], 'children' => false, 'ThemeId' => $parent_data['ThemeId']);
 			for ($i = 1; $i <= $language_count; $i++) {
 				$data['l'.$i.'_Name'] = $parent_data['l'.$i.'_Name'];
 			}
 
 			if (!$categories) {
 				// no children
 				return $data;
 			}
 
 			// category has children
 			foreach ($categories as $category_id => $category_data) {
 				$data['children'][$category_id] = $this->_getChildren($category_id, $language_count);
 			}
 
 			return $data;
 		}
 
 		/**
 		 * Generates OR retrieves from cache structure tree
 		 *
 		 * @return Array
 		 */
 		function &_getStructureTree()
 		{
 			// get cached version of structure tree
 			$sql = 'SELECT Data
 					FROM ' . TABLE_PREFIX . 'Cache
 					WHERE VarName = "StructureTree"';
 			$data = $this->Conn->GetOne($sql);
 
 			if ($data) {
 				$data = unserialize($data);
 
 				return $data;
 			}
 
 			// generate structure tree from scratch
 			$ml_helper =& $this->Application->recallObject('kMultiLanguageHelper');
 			/* @var $ml_helper kMultiLanguageHelper */
 
 			$language_count = $ml_helper->getLanguageCount();
 
 			$root_category = $this->Application->findModule('Name', 'Core', 'RootCat');
 			$data = $this->_getChildren($root_category, $language_count);
 
 			$fields_hash = 	Array (
 				'VarName'	=>	'StructureTree',
 				'Data'		=>	serialize($data),
 				'Cached'	=>	adodb_mktime(),
 			);
 
 			$this->Conn->doInsert($fields_hash, TABLE_PREFIX.'Cache', 'REPLACE');
 
 			return $data;
 		}
 
 		/**
 		 * Returns category structure as field option list
 		 *
 		 * @return Array
 		 */
 		function getStructureTreeAsOptions()
 		{
 			if (defined('IS_INSTALL') && IS_INSTALL) {
 				// no need to create category structure during install, because it's not used there
 				return Array ();
 			}
 
 			if (isset($this->_structureTree)) {
 				return $this->_structureTree;
 			}
 
 			$themes_helper =& $this->Application->recallObject('ThemesHelper');
 			/* @var $themes_helper kThemesHelper */
 
 			$data = $this->_getStructureTree();
 
 			$theme_id = (int)$themes_helper->getCurrentThemeId();
 			$root_category = $this->Application->findModule('Name', 'Core', 'RootCat');
 
 			$this->_structureTree = $this->_printChildren($data, $root_category, $this->Application->GetVar('m_lang'), $theme_id);
 
 			return $this->_structureTree;
 		}
 
 		/**
 		 * Replace links like "@@ID@@" to actual template names in given text
 		 *
 		 * @param string $text
 		 * @return string
 		 */
 		function replacePageIds($text)
 		{
 			if (!preg_match_all('/@@(\\d+)@@/', $text, $regs)) {
 				return $text;
 			}
 
 			$page_ids = $regs[1];
 
 			$sql = 'SELECT NamedParentPath, CategoryId
 					FROM ' . TABLE_PREFIX . 'Category
 					WHERE CategoryId IN (' . implode(',', $page_ids) . ')';
 			$templates = $this->Conn->GetCol($sql, 'CategoryId');
 
 			foreach ($page_ids as $page_id) {
 				if (!array_key_exists($page_id, $templates)) {
 					// internal page was deleted, but link to it was found in given content block data
 					continue;
 				}
 
 				$url_params = Array ('m_cat_id' => $page_id, 'pass' => 'm');
 				$page_url = $this->Application->HREF(strtolower($templates[$page_id]), '', $url_params);
 				/*if ($this->Application->IsAdmin()) {
 					$page_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $page_url);
 				}*/
 			$text = preg_replace('/@@' . $page_id . '@@/', $page_url, $text);
 			}
 
 			return $text;
 		}
 	}
\ No newline at end of file
Index: branches/5.0.x/core/admin_templates/js/jquery/thickbox/thickbox.css
===================================================================
--- branches/5.0.x/core/admin_templates/js/jquery/thickbox/thickbox.css	(revision 12458)
+++ branches/5.0.x/core/admin_templates/js/jquery/thickbox/thickbox.css	(revision 12459)
@@ -1,185 +1,185 @@
 /* ----------------------------------------------------------------------------------------------------------------*/
 /* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
 /* ----------------------------------------------------------------------------------------------------------------*/
 /* *{padding: 0; margin: 0;} */
 
 /* ----------------------------------------------------------------------------------------------------------------*/
 /* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
 /* ----------------------------------------------------------------------------------------------------------------*/
 #TB_window, .TB_window {
 	font: 12px Arial, Helvetica, sans-serif;
 	color: #333333;
 }
 
 #TB_secondLine {
 	font: 10px Arial, Helvetica, sans-serif;
 	color:#666666;
 }
 
 #TB_window a:link, .TB_window a:link {color: #666666;}
 #TB_window a:visited, .TB_window a:visited {color: #666666;}
 #TB_window a:hover, .TB_window a:hover {color: #000;}
 #TB_window a:active, .TB_window a:active {color: #666666;}
 #TB_window a:focus, .TB_window a:focus {color: #666666;}
 
 /* ----------------------------------------------------------------------------------------------------------------*/
 /* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
 /* ----------------------------------------------------------------------------------------------------------------*/
 #TB_overlay {
 	position: fixed;
 	z-index: 100;
 	top: 0px;
 	left: 0px;
 	height:100%;
 	width:100%;
 }
 
 .TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
 .TB_overlayBG {
 	background-color:#000;
 	filter:alpha(opacity=75);
 	-moz-opacity: 0.75;
 	opacity: 0.75;
 }
 
 * html #TB_overlay { /* ie6 hack */
      position: absolute;
      height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
 }
 
 #TB_window, .TB_window {
 
 	background: #ffffff;
 	z-index: 102;
 	color:#000000;
 	display:none;
 	border: 4px solid #525252;
 	text-align:left;
 
 	position: absolute;
 	top: 10px;
 	left: 10px;
 
 	/*position: fixed;
 	top:50%;
 	left:50%;*/
 }
 
 /** html #TB_window, * html .TB_window { /* ie6 hack */
 	position: absolute;
 	margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
 }*/
 
 #TB_window img#TB_Image, .TB_window img#TB_Image {
 	display:block;
 	margin: 15px 0 0 15px;
 	border-right: 1px solid #ccc;
 	border-bottom: 1px solid #ccc;
 	border-top: 1px solid #666;
 	border-left: 1px solid #666;
 }
 
 #TB_caption, .TB_caption {
 	height:25px;
 	padding:7px 30px 10px 25px;
 	float:left;
 }
 
 #TB_closeWindow, .TB_closeWindow {
 	height:25px;
 	padding:11px 25px 10px 0;
 	float:right;
 }
 
 #TB_closeAjaxWindow, .TB_closeAjaxWindow {
-	padding:7px 10px 5px 0;
-	margin-bottom:1px;
-	text-align:right;
-	float:right;
+	padding: 6px 10px 6px 0px;
+	/*margin-bottom: 1px;*/
+	text-align: right;
+	float: right;
 }
 
 #TB_ajaxWindowTitle, .TB_ajaxWindowTitle {
-	float:left;
-	padding:7px 0 5px 10px;
-	margin-bottom:1px;
+	float: left;
+	padding: 6px 0px 6px 10px;
+	/*margin-bottom: 1px;*/
 	font-weight: bold;
 }
 
 #TB_title, .TB_title {
 	background-color:#e8e8e8;
 	height:27px;
 }
 
 #TB_ajaxContent, .TB_ajaxContent {
 	clear:both;
 	padding:2px 15px 15px 15px;
 	overflow:auto;
 	text-align:left;
 	line-height:1.4em;
 }
 
 #TB_ajaxContent.TB_modal, .TB_ajaxContent.TB_modal {
 	padding:15px;
 }
 
 #TB_ajaxContent p, .TB_ajaxContent p {
 	padding:5px 0px 5px 0px;
 }
 
 #TB_load {
 	position: fixed;
 	display:none;
 	height:13px;
 	width:208px;
 	z-index: 103;
 	top: 50%;
 	left: 50%;
 	margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
 }
 
 * html #TB_load { /* ie6 hack */
 position: absolute;
 margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
 }
 
 #TB_HideSelect {
 	z-index: 99;
 	position:fixed;
 	top: 0;
 	left: 0;
 	background-color:#fff;
 	border:none;
 	filter:alpha(opacity=0);
 	-moz-opacity: 0;
 	opacity: 0;
 	height:100%;
 	width:100%;
 }
 
 * html #TB_HideSelect { /* ie6 hack */
      position: absolute;
      height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
 }
 
 #TB_iframeContent, .TB_iframeContent {
 	clear:both;
 	border:none;
 	margin-bottom:-1px;
 	/*margin-top:1px;*/
 	_margin-bottom:1px;
 }
 
 /* jQuery UI CSS */
 /* .ui-resizable { position: relative;} */
 .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
 .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
 .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
 .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
 .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
 .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
 .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
 .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
 .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
 .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
 
 .ui-draggable .TB_title { cursor: move; }
\ No newline at end of file
Index: branches/5.0.x/core/admin_templates/catalog/catalog_elements.tpl
===================================================================
--- branches/5.0.x/core/admin_templates/catalog/catalog_elements.tpl	(revision 12458)
+++ branches/5.0.x/core/admin_templates/catalog/catalog_elements.tpl	(revision 12459)
@@ -1,131 +1,131 @@
 <inp2:m_DefineElement name="top_catalog_tab">
 	<input type="radio" name="top_catalog_tab" id="<inp2:m_Param name='id'/>"<inp2:m_if check="m_IsActive" template="$template"> checked</inp2:m_if>/> <a href="<inp2:m_Link template='$template' pass='all'/>"><label for="<inp2:m_Param name='id'/>"><inp2:m_Phrase name="$label"/></label></a>
 </inp2:m_DefineElement>
 
 <inp2:m_DefineElement name="top_catalog_tab2" is_last="0">
 	<inp2:m_if check="m_IsActive" template="$template">
 		<td class="button-active" style="padding-right: 5px;">
 
 		</td>
 		<td class="button-active">
 			<img src="<inp2:m_TemplatesBase/>/img/top_frame/icons/<inp2:m_Param name='image'/>.gif" alt="" border="0"/>&nbsp;
 		</td>
 		<td class="button-active" style="padding-right: 5px;<inp2:m_ifnot check='m_Param' name='is_last'> border-right: 1px solid #BBBBBB;</inp2:m_ifnot>">
 			<strong><inp2:m_Phrase name="$label"/></strong>
 		</td>
 	<inp2:m_else/>
 		<inp2:c_HomeCategory result_to_var="home_category"/>
 		<td style="padding-right: 5px; height: 22px;">
 
 		</td>
 		<td>
 			<a class="kx-header-link" href="<inp2:m_Link template='$template' m_cat_id='$home_category'/>" onclick="getFrame('main').location.href = this.href; return false;">
 				<img src="<inp2:m_TemplatesBase/>/img/top_frame/icons/<inp2:m_Param name='image'/>.gif" alt="" border="0"/>
 			</a>&nbsp;
 		</td>
 		<td style="padding-right: 5px;<inp2:m_ifnot check='m_Param' name='is_last'> border-right: 1px solid #BBBBBB;</inp2:m_ifnot>">
 			<a class="kx-header-link" href="<inp2:m_Link template='$template' m_cat_id='$home_category'/>" onclick="getFrame('main').location.href = this.href; return false;"><inp2:m_Phrase name="$label"/></a>
 		</td>
 	</inp2:m_if>
 </inp2:m_DefineElement>
 
 <inp2:m_DefineElement name="mode_selector_radio">
-	<td align="right">
+	<td>
 		<img src="img/spacer.gif" height="8" width="1" alt=""/>
-		<div style="background-color: #F6F6F6; border: 1px solid #EDEDED; padding: 5px; float: right;">
-			<inp2:m_RenderElement name="top_catalog_tab" id="tab1" label="la_tab_Browse" template="catalog/item_selector/item_selector_catalog"/>
-			<inp2:m_RenderElement name="top_catalog_tab" id="tab2" label="la_tab_AdvancedView" template="catalog/item_selector/item_selector_advanced_view"/>
+		<div style="background-color: #F6F6F6; border: 1px solid #999999; padding: 5px; float: left;">
+			<inp2:m_RenderElement name="top_catalog_tab" id="tab2" label="la_tab_ShowAll" template="catalog/item_selector/item_selector_advanced_view"/>
+			<inp2:m_RenderElement name="top_catalog_tab" id="tab1" label="la_tab_ShowStructure" template="catalog/item_selector/item_selector_catalog"/>
 		</div>
 		<br clear="all"/>
 		<img src="img/spacer.gif" height="8" width="1" alt=""/>
 	</td>
 </inp2:m_DefineElement>
 
 <inp2:m_DefineElement name="mode_selector">
 	<td align="right">
-		<div style="background-color: #F6F6F6; border: 1px solid #EDEDED; padding: 5px; float: right;">
-			<inp2:m_RenderElement name="top_catalog_tab" id="tab1" label="la_tab_Browse" template="catalog/catalog"/>
-			<inp2:m_RenderElement name="top_catalog_tab" id="tab2" label="la_tab_AdvancedView" template="catalog/advanced_view"/>
+		<div style="background-color: #F6F6F6; border: 1px solid #999999; padding: 5px; float: right;">
+			<inp2:m_RenderElement name="top_catalog_tab" id="tab2" label="la_tab_ShowAll" template="catalog/advanced_view"/>
+			<inp2:m_RenderElement name="top_catalog_tab" id="tab1" label="la_tab_ShowStructure" template="catalog/catalog"/>
 		</div>
 	</td>
 </inp2:m_DefineElement>
 
 <inp2:m_DefineElement name="catalog_search_box">
 	<td style="white-space: nowrap; text-align: right; width: 300px;" align="right">
 		<div style="float: right">
 			<table cellpadding="0" cellspacing="0">
 				<tr>
 					<td>
 						<input 	type="text"
 							id="search_keyword"
 							class="filter"
 							name="search_keyword"
 							value=""
 							PrefixSpecial=""
 							Grid=""
 							ajax="1"
 							onkeydown="searchKeydown(event);"/>
 						<input type="text" style="display: none;"/>
 					</td>
 					<td style="white-space: nowrap;">
 						<script type="text/javascript">
 							function searchKeydown(event) {
 								$form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
 								set_hidden_field($Catalog.ActivePrefix + '_search_keyword', document.getElementById('search_keyword').value);
 								search_keydown(event, $Catalog.ActivePrefix, $Catalog.searchInfo[$Catalog.ActivePrefix].grid, 1);
 							}
 
 							b_toolbar = new ToolBar();
 
 							b_toolbar.AddButton( new ToolBarButton('search', '<inp2:m_phrase label="la_ToolTip_Search" escape="1"/>',
 									function() {
 										$form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
 										set_hidden_field($Catalog.ActivePrefix + '_search_keyword', document.getElementById('search_keyword').value);
 										search($Catalog.ActivePrefix, $Catalog.searchInfo[$Catalog.ActivePrefix].grid, 1);
 									} ) );
 
 							b_toolbar.AddButton( new ToolBarButton('search_reset_alt', '<inp2:m_phrase label="la_ToolTip_SearchReset" escape="1"/>',
 									function() {
 										$form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
 
 										set_hidden_field($Catalog.ActivePrefix + '_search_keyword', document.getElementById('search_keyword').value);
 										search_reset($Catalog.ActivePrefix, $Catalog.searchInfo[$Catalog.ActivePrefix].grid, 1);
 									} ) );
 
 							b_toolbar.Render();
 						</script>
 					</td>
 				</tr>
 			</table>
 		</div>
 	</td>
 </inp2:m_DefineElement>
 
 <inp2:m_DefineElement name="extra_toolbar">
 	<table cellpadding="0" cellspacing="0">
 		<tr>
 			<inp2:m_RenderElement name="top_catalog_tab2" image="show_all" label="la_tab_ShowAll" template="catalog/advanced_view" strip_nl="2"/>
 			<inp2:m_RenderElement name="top_catalog_tab2" image="show_structure" label="la_tab_ShowStructure" template="catalog/catalog" strip_nl="2" is_last="1"/>
 		</tr>
 	</table>
 </inp2:m_DefineElement>
 
 <inp2:m_DefineElement name="theme_selector">
 	<inp2:m_ifnot check="theme.enabled_TotalRecords" equals_to="0|1">
 		<inp2:m_Phrase label="lu_CurrentTheme"/>:
 		<select name="theme" id="theme" onchange="onChangeTheme();">
 			<inp2:m_DefineElement name="theme_elem">
 				<option value="<inp2:Field name="ThemeId"/>" <inp2:m_if check="SelectedTheme">selected="selected"</inp2:m_if> ><inp2:Field name="Name"/></option>
 			</inp2:m_DefineElement>
 
 			<inp2:theme.enabled_PrintList render_as="theme_elem"/>
 		</select>
 
 		<script type="text/javascript">
 			function onChangeTheme() {
 				set_hidden_field('theme', $('#theme').val());
 				submit_event('theme', 'OnChangeTheme');
 			}
 		</script>
 	</inp2:m_ifnot>
 </inp2:m_DefineElement>
\ No newline at end of file