/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.1                   # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/

$(document).ready(function(){var working=false;$('.jak-ajaxform').submit(function(e){e.preventDefault();if(working)return false;working=true;var lsform=$(this);var button=$(this).find('.ls-submit');$(this).find('.form-group').removeClass("has-danger");$(this).find('input, textarea').removeClass("is-invalid");$(this).find('input, textarea').removeClass("is-valid");$(this).find('#name-help').html("");if($('.jak-thankyou').hasClass('alert alert-danger'))$('.jak-thankyou').removeClass('alert alert-danger').hide();$(button).html(ls.ls_submitwait);var request=$.ajax({async:true,url:ls.main_url+ls.lsrequest_uri,type:"POST",data:$(this).serialize(),dataType:"json",processData:false,cache:false});request.done(function(msg){working=false;$(button).html(ls.ls_submit);if(msg.status){$('.jak-thankyou').addClass('alert alert-success').fadeIn(1000).html(msg.html);$(lsform)[0].reset();$(button).attr('disabled','disabled');var width=document.getElementById('lcjframesize').offsetWidth;var height=document.getElementById('lcjframesize').offsetHeight;iframe_resize(width,height,msg.widgetstyle,msg.baseurl);var counter=0;var interval=setInterval(function(){counter++;if(counter==6){window.location.replace(msg.link)}},1000)}else if(msg.login){window.location.replace(msg.link)}else{if(msg.html)$('.jak-thankyou').addClass("alert alert-danger").fadeIn(1000).html(msg.html);$.each(msg.errors,function(k,v){$('#'+k).addClass("is-invalid");$(lsform).find('#name-help').html(v);$('#'+k).closest(".form-group").addClass("has-danger")})}working=false})})});
