{% if goto != '' %}
<script>
if (typeof $('.model-list-row[data-href="{{ goto }}"]').offset() !== 'undefined') {
  $(document).scrollTop( $('.model-list-row[data-href="{{ goto }}"]').offset().top - 180);
}
</script>
{% endif %}

{% if common['isOrder'] %}
{% include 'scripts/common/list.volt' %}
{% endif %}

<script>
function openFullscreen(element) {
  $(element).addClass('img-enlargable');
  var src = $(element).attr('src');
  var modal;
  function removeModal(){ modal.remove(); $('body').off('keyup.modal-close'); }
  modal = $('<div>').css({
    background: 'RGBA(0,0,0,.5) url('+src+') no-repeat center',
    backgroundSize: 'contain',
    width:'100%', height:'100%',
    position:'fixed',
    zIndex:'10000',
    top:'0', left:'0',
    cursor: 'zoom-out'
  }).click(function(){
    removeModal();
  }).appendTo('body');
  //handling ESC
  $('body').on('keyup.modal-close', function(e){
    if(e.key==='Escape'){ removeModal(); }
  });
}
$('img[data-enlargable]').click(function(){
  openFullscreen($(this));
});
</script>
