function subNext($step, $pag) {
  $step.removeClass('is-showing');
  $step.next().addClass('is-showing');
  $pag.removeClass('is-active')
      .next().addClass('is-active');
}

function subPrev($step, $pag) {
  $step.removeClass('is-showing');
  $step.prev().addClass('is-showing');
  $pag.removeClass('is-active')
      .prev().addClass('is-active');
}

/*
function subSubmit($step, $pag) {
  subNext($step, $pag);
  setTimeout(function() {
    subNext($step.next(), $pag.next())
  }, 3000);
}
*/
/*
function subFinished($step, $pag) {
  $('#myModal').on('hidden.bs.modal', function() {
    $step.removeClass('is-showing');
    $pag.removeClass('is-active');
  });
  $('#myModal').modal('hide'); 
  $('#fname').text("Choose a file...");
  $('#submission-form').get(0).reset();
}
*/
$('div[class*=modal-btn-]').on('click', function() {
  var $btn = $(this),
      $step = $btn.parents('.modal-body'),
      stepIndex = $step.index(),
      $pag = $('.modal-header span').eq(stepIndex);
  
  if ($btn.hasClass('modal-btn-next')) {
    subNext($step, $pag);
  } else if ($btn.hasClass('modal-btn-prev')) {
    subPrev($step, $pag);
  }
  
  /*else if ($btn.hasClass('modal-btn-submit')) {
    subSubmit($step, $pag);
  } else if ($btn.hasClass('modal-btn-done')) {
    subFinished($step, $pag);
  } else if ($btn.hasClass('modal-btn-toggle')) {
    $('#myModal').find('.modal-body')
                 .first().addClass('is-showing')
                 .siblings().removeClass('is-showing');
    $('.modal-header span').first().addClass('is-active')
                           .siblings().removeClass('is-active');
  }*/
});

/*
$('#resume').on('change', function(e) {
  filename = e.target.value.split('\\').pop();
  if (filename)
    $('#fname').text(filename);
});
*/