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('First Name *'));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('Last Name'));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;');appendInput(f, l, i);l = document.createElement("label");l.setAttribute('for', 'candidate_email');l.appendChild(document.createTextNode('Email *'));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('Phone *'));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', 'resume');l.appendChild(document.createTextNode('Resume *'));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');i.setAttribute('required', 'required');appendInput(f, l, i);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/mp0zwi3/apply?source=' + source;createForm(document, 'mp0zwi3', 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, " "));}$("#mp0zwi3-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]);$("#mp0zwi3").html('');smoothScroll($(window), $("#mp0zwi3").offset().top, 200);$.ajax({url: baseUrl,type: 'POST',data: formData,async: true,cache: false,contentType: false,processData: false,success: function () {$("#mp0zwi3").html('

Thanks for your application, we will contact you as soon as possible!

');smoothScroll($(window), $("#mp0zwi3").offset().top, 200);},error: function() {$("#mp0zwi3").html('

An unexpected error has occurred :(
Please send us an email and we will contact you as soon as possible.

');smoothScroll($(window), $("#mp0zwi3").offset().top, 200);}});});