let modal = document.getElementById("myModal");

// Get the button that opens the modal
let btn = document.getElementById("share-btn");

// Get the <span> element that closes the modal
let span = document.getElementsByClassName("close-btn")[0];

// get the button that prints the site
let print = document.getElementById("print");

// When the user clicks the button, open the modal 
btn.onclick = () => {
  modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = () => {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = (event) => {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}


print.onclick = () => {
  window.print();
}


//replace broken images with specific default one
let brokenImage1 = document.getElementById('imgBroken1');
let brokenImage2 = document.getElementById('imgBroken2');

brokenImage1.onerror = function () {

  brokenImage1.setAttribute('src', 'https://recruitingapp-XXXX.de.umantis.com/PublicDocuments/108/ShowDocument/');

};

brokenImage2.onerror = function () {

  brokenImage2.setAttribute('src', 'https://recruitingapp-XXXX.de.umantis.com/PublicDocuments/108/ShowDocument/');

};

