var Wick = Wick || {}; 

Wick.ClickAndCollectModal = (function () {

  var mapToggler = $('.click-and-collect-toggler'),
      googleMap = $('#google-map'),
      mapTogglerText = $('.click-and-collect-toggler span');

  $('#modal-click-and-collect').on('hide.bs.modal', function () {
    var form = $(this).find('form')[0];
    form.reset();
    Wick.Forms.clearValidationErrors(form);
  });

  mapToggler.on('click', function () {
    googleMap.toggle();
    mapToggler.blur();
    if (mapTogglerText.text() === 'Hide map') {
      mapTogglerText.text('Show map')
    } else {
      mapTogglerText.text('Hide map')
    }
  })

})();
