text: (function(){function l(a){a.preventDefault();f?$.getJSON(k,$(a.currentTarget).serialize(),function(a){a.success?alert("Votes counted successfully."):alert("An error occurred.  Please try again.")}).fail(function(){alert("The Vote Counter app appears to be unavailable.")}):alert("Cannot submit votes.  Please ensure the total number of votes does not exceed the maximum.")}function m(){var a=document.getElementById("voteForm--totalVotes");a.classList.remove("text-danger");f=!0;var d=0,c;for(c=0;c<e.length;c+=
  1)d+=parseInt(e[c].value);a.innerText=d;if(isNaN(d)||110<d)a.classList.add("text-danger"),f=!1}function n(){document.getElementById("voteForm--maxVotes").innerText=110;e=document.getElementsByClassName("voteForm--candidate");var a;for(a=0;a<e.length;a+=1)e[a].addEventListener("change",m);$.getJSON("mockVoteCounter/mockVoteCounter.json",function(a){k=a.submitURL;document.getElementById("voteForm").addEventListener("submit",l);f=!0})}var g,h,e,f=!1,k;(function(){$.getJSON("pollingStations/pollingStations.json",
  function(a){h=a.pollingStations;a='<option value="">(Select a Polling Station)</option>';var d="",c;for(c=0;c<h.length;c+=1){var b=h[c],d=d+("<tr><td>"+b.PollingStationKey+"</td><td>"+b.PollingStationName+"</td><td>"+b.Address+"</td></tr>");a+='<option value="'+b.PollingStationKey+'">'+b.PollingStationKey+" - "+b.PollingStationName+"</option>"}document.getElementById("pollingStations-container").innerHTML=d;document.getElementById("voteForm--pollingStationKey").innerHTML=a})})();(function(){$.getJSON("candidates/candidates.json",
  function(a){g=a.candidates;var d=a="",c;for(c=0;c<g.length;c+=1){var b=g[c];a+='<div class="col-sm-6"><div class="card text-white bg-secondary mb-2">'+('<div class="card-body"><div class="row"><div class="col-md-4"><img class="img-fluid" src="candidates/'+b.CandidateImage+'" alt="'+b.CandidateName+'" /></div><div class="col-md-8">'+('<h3 class="card-title">'+b.CandidateName+"</h3>")+('<p class="card-text">'+b.MailingAddress+"<br />"+b.MailingCity+", "+b.MailingProvince+"<br />"+b.MailingPostalCode+
  "</p>")+"</div>")+"</div></div></div></div>";d+='<div class="row mb-2"><div class="col-sm-4"><label for="voteForm--candidate-'+b.CandidateKey+'">'+b.CandidateName+'</label></div><div class="col-sm-8"><input class="form-control text-right voteForm--candidate" id="voteForm--candidate-'+b.CandidateKey+'" name="'+b.CandidateKey+'" type="number" value="0" min="0" max="110" step="1" required /></div></div>'}document.getElementById("candidates-container").innerHTML=a;document.getElementById("voteForm-candidates-container").innerHTML=
  d;n()})})()})();
  