~includeonce('../config.tmpl') ~includeonce('../site/utils.tmpl') ~includeonce('../site/thumbnail.tmpl') ~setl('gal_img', ~get_first_img( ~get('res_type_galleries'), ~integer(~get_filenamevar(1)),~integer(~get_filenamevar(2))-1)) ~setl('cur_img', ~get('first_img_id')) ~setl('cur_alt', ~get('first_img_alt')) ~setl('tmp', ~get_first_img( ~get('res_type_galleries'), ~integer(~get_filenamevar(1)),~integer(~get_filenamevar(2))+0)) ~if( ~getl('tmp'), ~setl('next_img', ~get('first_img_id')) ) ~if( ~integer(~get_filenamevar(2))>1, ' ~setl('tmp', ~get_first_img( ~get('res_type_galleries'), ~integer(~get_filenamevar(1)),~integer(~get_filenamevar(2))-2)) ~setl('prev_img', ~get('first_img_id')) ') ~noeval(~getl('tmp'), ~add_meta('http-equiv="refresh" content="8; url=photos,~get_filenamevar(1),~integer( ~get_filenamevar(2) +1 ).html"')) ~list(~get('database'), "SELECT title FROM galleries WHERE id=~integer(~get_filenamevar(1)) AND state=~get('state_ok')", 'LM',~set('title', '~fld('title') / ~getl('cur_alt')', 'gallery_title', ~fld('title')), 'LD',~http_error(404) ) ~include('../site/header.tmpl')
~if( ~getl('prev_img'), ' ~get_img_thumbnail(~getl('prev_img')) ') ~if( ~getl('next_img'), ' ~get_img_thumbnail(~getl('next_img')) ')
~if( ~getl('next_img'),'')
~getl('gal_img')
~if( ~getl('next_img'),'')
~fld('alt')
~if(~fld('description'),
~include('../site/replace.tmpl', ~output_filter(~fld('description')), '', ~get('res_type_galleries'), ~integer(~get_filenamevar(1)))
)