<?php
/**
 * @package Flatnux_module_gallery
 * @author Alessandro Vernassa <speleoalex@gmail.com>
 * @author John D'Orazio <donjohn.fmmi@gmail.com>
 * @copyright Copyright (c) 2003-2005
 * @license http://opensource.org/licenses/gpl-license.php GNU General Public License
 */
defined('_FNEXEC') or die('Restricted access');

global $_FN;
require_once ("modules/gallery/photo_functions.php");
//-----------------------------     config     -------------------------------->
$config = FN_LoadConfig("modules/gallery/config.php");
$movie_extensions = $config['movie_extensions'];
$ThumbSize = $config['ThumbSize'];
$Num_Cols = $config['Num_Cols'];
$photodir = $config['photodir'];
$photogroup = $config['photogroup'];
$movie_extensions = $config['movie_extensions'];
$create_thumbs_dir = $config['create_thumbs_dir'];
$use_lightbox = $config['use_lightbox'];
//-----------------------------     config     -------------------------------->

$pathscript = "{$_FN['siteurl']}modules/gallery/lightbox";
if ($use_lightbox == 1)
{
    $_FN['section_header_footer'] .= "
<link rel=\"stylesheet\" href=\"$pathscript/lightbox.css\" type=\"text/css\" media=\"screen\" />
<script src=\"$pathscript/prototype.js\" type=\"text/javascript\"></script>
<script src=\"$pathscript/scriptaculous.js?load=effects,builder\" type=\"text/javascript\"></script>
<script src=\"$pathscript/lightbox.js\" type=\"text/javascript\"></script>
<script type=\"text/javascript\">
	LightboxOptions.fileLoadingImage = '$pathscript/loading.gif';
	LightboxOptions.fileBottomNavCloseImage = '$pathscript/closelabel.gif';
</script>
";
}
elseif ($use_lightbox == 2)
{
    $pathscript = "{$_FN['siteurl']}modules/gallery/lightbox_jquery/";
    echo "
    <script type=\"text/javascript\">
  if (typeof jQuery == 'undefined') {  
      document.write('<scr'+'ipt type=\"text/javascript\" src=\"{$_FN['siteurl']}modules/gallery/lightbox_jquery/jquery.min.js\"><'+'/script>');
  }
</script>";
    $_FN['section_header_footer'] .= "
  <link rel=\"stylesheet\" href=\"$pathscript/colorbox.css\" type=\"text/css\" media=\"screen\" />
  <script src=\"$pathscript/colorbox/jquery.colorbox-min.js\" type=\"text/javascript\"></script>
  <script type=\"text/javascript\">
		wide = ($(window).width()-20)+'px';
		high = ($(window).height()-20)+'px';
    $(document).ready(function(){
			$(\"a[rel='jqlightbox']\").colorbox({
        maxWidth:wide,
        maxHeight:high,
        title:function(){
          var titl = $(this).attr('title');
          var url = $(this).attr('href');
          var desc = $(this).attr('data-desc');
          return '<span title=\"' + desc + '\">' +titl + '</span>' + '&nbsp;&nbsp;&nbsp;<a href=\"" . $_FN["siteurl"] . "?mod={$_FN['mod']}&downloadfile=' + url + '" . "\"><img src=\"{$_FN['siteurl']}modules/gallery/lightbox_jquery/download-icon.png\" title=\"".FN_Translate("download")."\" alt=\"".FN_Translate("download")."\" /></a>';
        },
        current: '{current} di {total}',
        onComplete: function(){
          var el = $('.cboxPhoto');
          var desc = $(this).attr('data-desc');
          el.attr('title',desc);
        }
      });
		});
  </script>
  ";
}
//?mod=gallery&amp;dir=&amp;downloadfile=73202-morainelake.jpg'
if ($config['allow_multi_upload'])
{
    $pathscript = "{$_FN['siteurl']}modules/gallery/fileuploader/";
    if (FNGALLERY_IsGalleryAdmin())
    {
        echo "<link href=\"{$pathscript}fileuploader.css\" rel=\"stylesheet\" type=\"text/css\">";
    }
}
?>