<? global $lang; ?>
<fieldset>
	<table class='table_browse'>
    <thead>
      <tr>
        <td class='header' style='width: 15px;'><?=$lang -> getTrans( 'T_LP' );?></td>
        <td class='header'><?=ucfirst( $lang -> getTrans( 'T_NAZWA' ) );?></td>
        <td class='header'><?=ucfirst( $lang -> getTrans( 'T_AKTYWNA' ) );?></td>
        <td class='header'><?=ucfirst( $lang -> getTrans( 'T_TYP_STRONY' ) );?></td>
        <td class='header'><?=ucfirst( $lang -> getTrans( 'T_KOLEJNOSC_WYSWIETLANIA' ) );?></td>
        <td class='header'><?=ucfirst( $lang -> getTrans( 'T_LISTA_ARTYKULOW' ) );?></td>
        <td class='header' style='width: 15px;'></td>
        <td class='header' style='width: 15px;'></td>
        <td class='header' style='width: 15px;'></td>
        <td class='header' style='width: 15px;'></td>
      </tr>
    </thead>
    <tbody>
		<?
		$i = 0;
		if ( is_array( $this -> _pages ) ) foreach ( $this -> _pages as $page )
		{
			?>
			<div class="contextMenu" id="menu<?=$i;?>" style="display:none;">
				<ul>
					<li id="open" class="context_menu">
						<a href='index.php?rw=edit&amp;id=<?=$page['id'];?>' style="display: block; height: 30px; line-height: 30px;">
							<span class='icon edit' style='display: block; float: left; margin: 5px 5px 0 0;'></span>
							<?=$lang -> getTrans( 'T_EDYTUJ' )?>
						</a>
					</li>
					<li id="delete" class="context_menu">
						<a <?=$page['action'];?> style="display: block; height: 30px; line-height: 30px;">
							<span class='icon delete' style='display: block; float: left; margin: 5px 5px 0 0;'></span>
							<?=$lang -> getTrans( 'T_USUN' );?>
						</a>
					</li>
					<?
					if ( $page['page_down'] )
					{
						?>
						<li id="show" class="context_menu">
							<a href="index.php?rw=down&amp;id=<?=$page['page_down'];?>" style="display: block; height: 30px; line-height: 30px;">
								<div class='icon down_main' style='display: block; float: left; margin: 5px 5px 0 0;'></div>
								<?=$lang -> getTrans( 'T_W_DOL' );?>
							</a>
						</li>
						<?
					}
					if ( $page['page_up'] )
					{
						?>
						<li id="show" class="context_menu">
							<a href="index.php?rw=up&amp;id=<?=$page['page_up'];?>" style="display: block; height: 30px; line-height: 30px;">
								<div class='icon up_main' style='display: block; float: left; margin: 5px 5px 0 0;'></div>
								<?=$lang -> getTrans( 'T_W_GORE' );?>
							</a>
						</li>
						<?
					}
					?>
				</ul>
			</div>
			  <script type='text/javascript'>
				$(document).ready(function(){
				  $('.menu<?=$i;?>').contextMenu('menu<?=$i;?>', {
					itemStyle: {
					  backgroundColor: '#E5E5E5',
					  width: '120px',
					},
					itemHoverStyle: {
					  backgroundColor: '#FFFFFF',
					  border: '1px solid #FFFFF',
					}
				  });
				});
			  </script>
			<tr class='menu<?=$i;?>'>
				<td class='row'><?=$page['lp'];?>.</td>
				<td class='row'><?=$page['title'];?></td>
				<td class='row'><?=$page['enabled'];?></td>
				<td class='row'><?=$page['page_type'];?></td>
				<td class='row'><?=$page['sort_type'];?></td>
				<td class='row'>
          <a href="./?rw=article_list&id=<?=$page['id'];?>" style="color: #3D73C2;">pokaż</a>
        </td>
				<td class='row'>
				<?
				if ( $page['page_down'] )
				{
					?><div class='icon down_main' onClick='document.location.href="index.php?rw=down&amp;id=<?=$page['page_down'];?>";'></div><?
				}
				?>
				</td>
				<td class='row'>
				<?
				if ( $page['page_up'] )
				{
					?><div class='icon up_main' onClick='document.location.href="index.php?rw=up&amp;id=<?=$page['page_up'];?>";'></div><?
				}
				?>
				</td>
				<td class='row'>
          <a href='index.php?rw=edit&amp;id=<?=$page['id'];?>'>
            <span class='icon edit' style='display:block;'></span>
          </a>
        </td>
				<td class='row'>
          <a <?=$page['action'];?>>
            <span class='icon delete' style='display:block;'></span>
          </a>
        </td>
			</tr>
			<?
      $i++;
		}
		?>
  </tbody>
	</table>
	<? include 'site-paging.php' ;?>
</fieldset>
<script type='text/javascript'>
  $(document).ready(function(){
    var cssObj = {
      'display' : 'block',
      'height' : '30px',
      'line-height' : '30px',
	  'color' : '#000000',
	  'font-size' : '10px',
	  'padding-left' : '5px',
	  'text-transform' : 'uppercase'
    }
    $("li.context_menu").children("a").css( cssObj );
    var cssObj2 = {
      'float' : 'left',
      'margin' : '5px 5px 0 0',
	  'color' : '#000000',
	  'font-size' : '10px',
	  'padding-left' : '5px',
	  'text-transform' : 'uppercase'
    }
    $("li.context_menu").children("a").children("span.edit").css( cssObj2 );
    $("li.context_menu").children("a").children("span.delete").css( cssObj2 );
    $("li.context_menu").children("a").children("span.show").css( cssObj2 );
    $("li.context_menu").children("a").children("div.down_main").css( cssObj2 );
    $("li.context_menu").children("a").children("div.up_main").css( cssObj2 );
  });
 </script>