<? $this->load->view( $this->aSystemVar['template_viewer_root'] . '_header') ?>

	<div id="current_category">
		<div class="title">
			<?= $data['CurrentCategory']['Title'] ?>
			&nbsp;<a href="<?=site_url('rss/'.$data['CurrentCategory']['BaseName'])?>"><img src="<?=base_url().'/views/_images/rss_feed_14.png'?>" /></a>
		</div>
		<div class="description"><?= $data['CurrentCategory']['Description'] ?></div>
		<div class="icon">
			<?
				if( empty($data['CurrentCategory']['IconUrl']) ):
					$icon = $this->config->item('design_icon_url').'folder.jpg';
				else:
					$icon = $data['CurrentCategory']['IconUrl'];
				endif;
			?>
			<img src="<?= $icon; ?>" alt="" title="<?= $data['CurrentCategory']['Title'] ?>" />
		</div>
	</div>
	<div id="breadcrumb">
		<span><?= anchor( base_url(), $this->lang->line('home') ) ?></span>
		<? foreach( $data['CurrentCategory']['BreadCrambList'] as $iId => $aValue ): ?>
		<span class="divider"><?= $this->config->item('breadcrumb_divider') ?></span>
		<span><?= anchor( $this->config->item('uri_category') . $aValue['BaseName'], $aValue['Title'] ) ?></span>
		<? endforeach; ?>
	</div>
	<? if(!empty($data['CategoryList'])): ?>

	<div id="categories">
	    <h2>
			<?= $this->lang->line('sub_categories') ?>
		</h2>
        <div class="clearBoth"></div>
            <?
				$i = 1;
				foreach( $data['CategoryList'] as $aCategory ):
			?>
				<div class="category">
				<?
                    if ( empty($aCategory['IconUrl']) )
					{
						$icon = $this->config->item('design_icon_url').'folder.jpg';
					}
					else
					{
						$icon = $aCategory['IconUrl'];
					}
				?>

				<a href="<?= site_url($this->config->item('uri_category').$aCategory['BaseName']) ?>"><img src="<?=$icon;?>" alt="" title="<?= $aCategory['Title']; ?>" class="cat_icon" /></a>
				<?= anchor( $this->config->item('uri_category') . $aCategory['BaseName'], $aCategory['Title'], ' class="title" title="' . $aCategory['Title'] .  '" ' ); ?>

					<? if( !empty($aCategory['subcategories']) ): ?>
						<div class="subcategory">
						<?
						$j = 1;
						$iSubCount = count($aCategory['subcategories']);
						foreach($aCategory['subcategories'] as $aSubCategory)
						{
							echo  anchor($this->config->item('uri_category') . $aSubCategory['BaseName'], $aSubCategory['Title']);
							if( $j >= 4 )
							{
								break;
							}
							else
							{
								if( $j < $iSubCount)
									echo ', ';
							}
							$j++;
						}
						?>
						</div>
					<? endif; ?>


				</div>
			<?
				if( 0 == $i%2 )
					echo '<div class="clearBoth"></div>';
				$i++;
				endforeach;
			?>
			<div class="clearBoth"></div>
	</div>
	<? endif; ?>

				<? if( empty( $data['PostList']) ): ?>
					<div class="advice">
						<?= $this->lang->line('this_category_empty') ?>
					</div>
				<? else:?>
				<div id="articles">
					<div id="recent">
					<?
						$i = 0;
						foreach( $data['PostList'] as $aPost )
						{
							if( ($i%2) == 0 )
							{
								$aPost['class'] = 'even';
							}
							else
							{
								$aPost['class'] = 'odd';
							}
							$this->load->view( $this->aSystemVar['template_viewer_root'] . 'design_items/post_box', $aPost );
							$i++;
						}
					?>
					</div>
				</div>
				<div class="pagination">
				<?
					$aPagination['Pagination'] = $data['Pagination'];
					$this->load->view( $this->aSystemVar['template_viewer_root'] . 'design_items/pagination', $aPagination );
				?>
				</div>
				<? endif; ?>
<? $this->load->view( $this->aSystemVar['template_viewer_root'] . '_footer') ?>