<style type="text/css">
  .ui-widget-content {
    background: none !important;
    border: none !important;
  }  
  .ui-widget-header {
    border: none !important;
    background: none !important;
  }
  .ui-widget {
    font-family: inherit !important;
  }
  .ui-tabs .ui-tabs-panel {
    padding: 0px !important;
  }
  .ui-tooltip {
    background: #FFF;
    border-radius: 0;    
    border: 1px solid #D1D4D7 !important;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    color:  #656565;
    font-size: 11px;
  }
</style>

<script>
  $(document).ready(function() {
    
    $( '#slider-code' ).tinycarousel({
      pager: true
    });
    
    $( ".tabs a" ).click( function () 
    {
			$( ".tabs .active" ).removeClass( "active" );
			$( this ).addClass( "active" );
			$( ".tabs-content" ).addClass( 'nondisplay' );
			var content_show = $( this ).attr( "href" );
			$( '#' + content_show ).removeClass( 'nondisplay' );
		  return false;
		});
    
    <? if ( $this -> _rw == 'add' ):?>
      $( "#id_page_type" ).val( '2' );
    <? endif;?>
    changePageType();
  });

  function changePageType()
  {
    var type = $("#id_page_type").val();
    if ( type == 5 || type == 6 || type == 7 || type == 8 || type == 9 || type == 10 || type == 11 )
    {
      $( '#div_article_number, #div_sort_type' ).hide();
      if ( type == 8 ) 
      {
        $( '#div_show_title' ).hide();
        $( '#div_link' ).show();
      } 
      else 
      {
        $( '#div_link' ).hide();
        $( '#div_show_title' ).show();
      }
    }
    else
    {
      $( '#div_article_number, #div_sort_type' ).show();
      $( '#div_link' ).hide();
      $( '#div_show_title' ).show();
    }
  }
</script>

<div class="edit-row">
  <form method='POST' id='formularz' action='./'>
    <? if ( $this -> _container ):?>
      <input type='hidden' name='rw' value='save' />
      <input type='hidden' name='id' value='<?= $this -> _container['id'];?>' />
    <? else:?>
      <input type='hidden' name='rw' value='save_new' />
      <input type='hidden' name='check' value='<?= mktime();?>' />
    <? endif;?>
    <div id="tabs" class="tabs-container">
      <ul class="tabs">
        <?
        if ( is_array( $this -> _languages ) ) foreach ( $this -> _languages as $lg )
        {
          ?>
          <li class="tab-li">
            <a href="lang_<?= $lg['id'];?>" class="li-tabs <? if ( !$j++ ) echo 'active';?>"><?= $lg['name'];?></a>
          </li>
          <?
        }
        ?>
      </ul>
      <div class="group">
        <label>Nazwa:</label>
        <div class="content">
          <input type='text' name='name' id='name' value='<?= $this -> _container['name'];?>' />
        </div>
      </div>
      <div class="group">
        <label>Aktywny:</label>
        <div class="content">
          <input type="radio" name="enabled" id="enabled_0" value="0" <? if ( !$this -> _container['enabled'] ) echo "checked='checked'";?> />
          nie
          <input type="radio" name="enabled" id="enabled_1" value='1' <? if ( $this -> _container['enabled'] ) echo "checked='checked'";?> />
          tak
        </div>
      </div>
      <?
      if ( is_array( $this -> _languages ) ) foreach ( $this -> _languages as $lg )
      {
        ?>
        <script type="text/javascript">
          $(document).ready(function(){
            $( 'textarea#text_<?= $lg['id'];?>' ).ckeditor( {
              toolbar : 'MyToolbar',
              height:'250',
              width: '900px',
              language: 'pl'
            });
          });
        </script>
        <div id="lang_<?= $lg['id'];?>" class="tabs-content <? if ( $i++ ) echo 'nondisplay';?>">
          <div class="group">
            <label>Tekst:</label>
            <div class="content">
              <textarea name='text_<?= $lg['id'];?>' id="text_<?= $lg['id'];?>" cols='60' rows='5'><?= $this -> secureHTML( $lg['content'] );?></textarea>
            </div>
            <div class="clearfix"></div>
          </div>
        </div>
        <?
      }
      ?>
    </div>
  </form>
</div>