<?php

  $vand = $voice_site->getImg( KiP_root . $spal . "/" );
  
  $separ = base64_encode ( "KiPhoto" );
  
  //list ( $limg, $totale, $lmodi ) = explode ( $separ, $vand );
  list ( $limg, $totale, $lmodi, $nfol, $elfol ) = explode ( $separ, $vand );

  $biz = explode ( " ", $lmodi );
  $lmodi = $voice_site->parse_date ( $biz[0], $_LANG ) . " - " . $biz[1];

  if ( intval ( $totale ) == 1 ) { $sfex = "e"; $lfex = $voice_site->parse_lang("detail_album_img_s", $_SESSION['lang'], $_LANG); }
  elseif ( intval ( $totale ) > 1 ) { $sfex = "i"; $lfex = $voice_site->parse_lang("detail_album_img_m", $_SESSION['lang'], $_LANG); }

  include( KiP_tpl . "pages/small_info.php" );
  $pinfo = $tpl_smalli;

  if ( isset ( $_GET['to_p'] ) && !empty ( $_GET['to_p'] ) && is_numeric ( $_GET['to_p'] ) ) { $nump = $_GET['to_p']; }
  else { $nump = "0"; }

  $info_fold = $voice_site->getElencAlbum( KiP_root, KiP_tpl );
  //$visual_img = $voice_site->VisualImg ( $limg, KiP_tpl, $nump );
  $visual_img = "";
  if ( $nfol != "0" ) {
    $visual_img .= "
    <div class='distinction'>Sottocartelle presenti:</div>
    ";
    $defra = explode ( "|", $elfol );
    for ( $g = 0; $g < count ( $defra ); $g++ ) {
      list ( $perc_sf, $nome_sf ) = explode ( "noka", $defra[$g] );
      $sf_link = $voice_site->codeLink( str_replace ( KiP_root, "", $perc_sf ) );
      $sf_img = $perc_sf . "/" . $voice_site->getAlbImg( $perc_sf . "/" );
      include( KiP_tpl . "pages/subf.php" );
      $visual_img .= $tpl_subf;
    }
    $visual_img .= "
    <br class='clear' />
    <div class='distinction'>Immagini presenti:</div>";
  }
  $visual_img .= $voice_site->VisualImg ( $limg, KiP_tpl, $nump );

  //$KiLang = $voice_site->getLang ( KiP_hroot . "locale/", KiP_tpl );
  $KiLang = $voice_site->getFlag ( KiP_tpl );

  if ( $totale > 20 ) {
  
    $totp = ( (int)( $totale / 20 ) );

    if ( $nump > 0 ) {
      $c = ( $nump - 1 );
      if ( $c == "0" ) { $c = 0; $sense = ""; }
      else { $sense = "&to_p=" . $c; }
      $left = "<a href='" . KiP_url . "?album=" . $_GET['album'] . "&step=" . $_GET['step'] . "&tpuls=" . $_GET['tpuls'] . $sense . "' style='text-decoration: none;'><img vspace='0' hspace='0' src='" . KiP_url . KiP_tpl . "images/arrow/previous.png'alt='Indietro' border='0' /> <strong>Pagina Precedente</strong></a>";
    }
    
    if ( $nump < $totp ) {
      $right = "<a href='" . KiP_url . "?album=" . $_GET['album'] . "&step=" . $_GET['step'] . "&tpuls=" . $_GET['tpuls'] . "&to_p=" . ( $nump + 1 ) . "' style='text-decoration: none;'><strong>Pagina Successiva</strong> <img vspace='0' hspace='0' src='" . KiP_url . KiP_tpl . "images/arrow/next.png'alt='Avanti' border='0' /></a>";
    } elseif ( $nump == $totp ) { $right = ""; }
  
    $arrow = "
    <br class='clear' />
    <div style='padding:3px;'>
      <div style='text-align:left; float: left;'>
        " . $left . "
      </div>
      <div style='text-align:right; float: right;'>
        " . $right . "
      </div>
      <br class='clear' />
    </div>";
  
  } else { $arrow = ""; }

  include( KiP_tpl . "pages/visual.php" );
  $site_text = $tpl_show_img;