console.log('Requesting with language sv');function smoothScroll(el, to, duration) {if (duration < 0) {return;}var difference = to - $(window).scrollTop() - 100;var perTick = difference / duration * 10;this.scrollToTimerCache = setTimeout(function() {if (!isNaN(parseInt(perTick, 10))) {window.scrollTo(0, $(window).scrollTop() + perTick);smoothScroll(el, to, duration - 10);}}.bind(this), 10);}function createForm(document, jobId, url, language) {var i, l, s;var checkbox_counter = 0;var f = document.createElement("form");function fromRequiredString(str) {return str === "true" || str === "required";}function appendInput(form, label, input) {if (label) {form.appendChild(label);form.appendChild(document.createElement("br"));}form.appendChild(input);form.appendChild(document.createElement("br"));}function appendSelection(fieldset, label, checkbox, text) {fieldset.appendChild(label);label.appendChild(checkbox);label.appendChild(document.createTextNode(text));fieldset.appendChild(document.createElement("br"));}function selections(name, labelText, required, choices, type) {var fieldset = document.createElement('fieldset');fieldset.setAttribute('style', 'border: 1px solid #ccc;border-radius: 4px;margin-bottom:15px;');f.appendChild(fieldset);var legend = document.createElement('legend');legend.appendChild(document.createTextNode(labelText + (required ? " *" : "")));fieldset.appendChild(legend);for(var ctr = 0; ctr < choices.length; ctr++) {l = document.createElement("label");l.setAttribute('for', name + '-' + ctr);i = document.createElement("input");i.setAttribute('type', type);i.setAttribute('name', name);i.setAttribute('id', name + '-' + ctr);i.setAttribute('value', choices[ctr]);i.setAttribute('style', 'margin-right: 10px;');if (required && type === "radio" && ctr == 0) {i.setAttribute('required', 'required');}appendSelection(fieldset, l, i, choices[ctr]);}}f.setAttribute('id', jobId + '-form');f.setAttribute('method', 'post');f.setAttribute('action', url);f.setAttribute('enctype', 'multipart/form-data');l = document.createElement("label");l.setAttribute('for', 'candidate_first_name');l.appendChild(document.createTextNode('Förnamn *'));i = document.createElement("input");i.setAttribute('type', 'text');i.setAttribute('name', 'candidate_first_name');i.setAttribute('id', 'candidate_first_name');i.setAttribute('maxlength', 200);i.setAttribute('style', 'width:100%;border: 1px solid #ccc;border-radius: 4px;padding: 6px 12px;font-size: 14px;height:34px;margin-bottom:15px;');i.setAttribute('required', 'required');appendInput(f, l, i);l = document.createElement("label");l.setAttribute('for', 'candidate_last_name');l.appendChild(document.createTextNode('Efternamn *'));i = document.createElement("input");i.setAttribute('type', 'text');i.setAttribute('name', 'candidate_last_name');i.setAttribute('id', 'candidate_last_name');i.setAttribute('maxlength', 200);i.setAttribute('style', 'width:100%;border: 1px solid #ccc;border-radius: 4px;padding: 6px 12px;font-size: 14px;height:34px;margin-bottom:15px;');i.setAttribute('required', 'required');appendInput(f, l, i);l = document.createElement("label");l.setAttribute('for', 'candidate_email');l.appendChild(document.createTextNode('E-post *'));i = document.createElement("input");i.setAttribute('type', 'email');i.setAttribute('name', 'candidate_email');i.setAttribute('id', 'candidate_email');i.setAttribute('placeholder', 'jane@doe.com');i.setAttribute('style', 'width:100%;border: 1px solid #ccc;border-radius: 4px;padding: 6px 12px;font-size: 14px;height:34px;margin-bottom:15px;');i.setAttribute('required', 'required');appendInput(f, l, i);l = document.createElement("label");l.setAttribute('for', 'candidate_phone');l.appendChild(document.createTextNode('Telefon *'));i = document.createElement("input");i.setAttribute('type', 'tel');i.setAttribute('name', 'candidate_phone');i.setAttribute('id', 'candidate_phone');i.setAttribute('placeholder', '+46');i.setAttribute('style', 'width:100%;border: 1px solid #ccc;border-radius: 4px;padding: 6px 12px;font-size: 14px;height:34px;margin-bottom:15px;');i.setAttribute('required', 'required');appendInput(f, l, i);l = document.createElement("label");l.setAttribute('for', 'personligt_brev');l.appendChild(document.createTextNode('Personligt brev'));i = document.createElement("textarea");i.setAttribute('name', 'personligt_brev');i.setAttribute('id', 'personligt_brev');i.setAttribute('rows', '10');i.setAttribute('cols', '40');i.setAttribute('style', 'width:100%;border: 1px solid #ccc;border-radius: 4px;padding: 6px 12px;font-size: 14px;margin-bottom:15px;');appendInput(f, l, i);l = document.createElement("label");l.setAttribute('for', 'resume');l.appendChild(document.createTextNode('CV/profil'));i = document.createElement("input");i.setAttribute('type', 'file');i.setAttribute('name', 'profile');i.setAttribute('id', 'resume');i.setAttribute('style', 'width:100%;border: 1px solid #ccc;border-radius: 4px;padding: 6px 12px;font-size: 14px;height:34px;margin-bottom:15px;');i.setAttribute('accept', '.doc,.docx,.xml,application/msword,.pdf,.txt');appendInput(f, l, i);l = document.createElement("label");l.setAttribute('for', 'linkedin');l.appendChild(document.createTextNode('LinkedIn'));i = document.createElement("input");i.setAttribute('type', 'text');i.setAttribute('name', 'linkedin');i.setAttribute('id', 'linkedin');i.setAttribute('maxlength', 200);i.setAttribute('style', 'width:100%;border: 1px solid #ccc;border-radius: 4px;padding: 6px 12px;font-size: 14px;height:34px;margin-bottom:15px;');appendInput(f, l, i);l = document.createElement("label");l.setAttribute('for', 'var_hittade_du_vår_annons');l.appendChild(document.createTextNode('Var hittade du vår annons?'));selections('var_hittade_du_vår_annons', 'Var hittade du vår annons?', fromRequiredString(''), ['Google', 'Indeed', 'Arbetsförmedlingen', 'LinkedIn (jobbannons)', 'Sociala medier', 'Genom tips', 'Direktbesök till vår webb'], 'radio');s = document.createElement("input");s.setAttribute('type',"submit");if ('sv' === 'sv') {s.setAttribute('value',"Ansök nu!");} else {s.setAttribute('value',"Apply now!");}s.setAttribute('class', 'btn btn-lightup');f.appendChild(s);document.getElementById(jobId).appendChild(f);}var source = getParameterByName('source') || 'Website';var baseUrl = 'https://cygni-recruiterbox.herokuapp.com/openings/mp0pvy1/apply?source=' + source;createForm(document, 'mp0pvy1', baseUrl, getParameterByName('language') || 'en');function getParameterByName(name) {name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");var regex = new RegExp("[\\?&]" + name + "=([^]*)"),results = regex.exec(location.search);return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));}$("#mp0pvy1-form").submit(function( event ) {var allIsOk = true;event.preventDefault();$(this).find('input[required="required"]').each(function() {if (!$(this).val()) {$(this).css("border-color", "red");allIsOk = false;}});if (!allIsOk) {alert("Please enter all required fields before proceeding.");return;}var formData = new FormData($(this)[0]);$("#mp0pvy1").html('');smoothScroll($(window), $("#mp0pvy1").offset().top, 200);$.ajax({url: baseUrl,type: 'POST',data: formData,async: true,cache: false,contentType: false,processData: false,success: function () {$("#mp0pvy1").html('
Thanks for your application, we will contact you as soon as possible!
');smoothScroll($(window), $("#mp0pvy1").offset().top, 200);},error: function() {$("#mp0pvy1").html('An unexpected error has occurred :(
Please send us an email and we will contact you as soon as possible.