(function($){var current_fs,next_fs,previous_fs;var left,opacity,scale;var animating;var has_response=false;var preview_clicked=false;jQuery(document).ready(function($){$('form.wpcf7-form').each(function(index,el){var totalFieldset=0;var this_form=$(el);var findFieldset=$(el).find('fieldset.fieldset-cf7mls');if(findFieldset.length>0){$.each(findFieldset,function(i2,el2){if(i2==0){$(el2).addClass('cf7mls_current_fs');} jQuery(el2).attr('data-cf7mls-order',i2);totalFieldset=totalFieldset+1;var acceptances=jQuery(el2).find('input:checkbox.wpcf7-acceptance');if(acceptances.length){cf7mls_toggle_next_btn(acceptances,el2);}});$.each(findFieldset,function(i2,el2){if(i2==(totalFieldset-1)){$(el2).find('.cf7mls_next').remove();}});$(el).attr('data-count-fieldset',totalFieldset);if(cf7mls_object.disable_enter_key){$(el).find('[type="submit"]').click(function(event){var findFieldset=$(el).find('fieldset.fieldset-cf7mls.cf7mls_current_fs');if(findFieldset.data('cf7mls-order')!=(totalFieldset-1)){findFieldset.find('.cf7mls_next').click();return false;}});}else{$(el).submit(function(event){var findFieldset=$(el).find('fieldset.fieldset-cf7mls.cf7mls_current_fs');if(findFieldset.data('cf7mls-order')!=(totalFieldset-1)){findFieldset.find('.cf7mls_next').click();return false;}});}} $(el).find('input.wpcf7-cf7_answer').each(function(njt_a_i,njt_a_e){var $this=$(njt_a_e);var qf=this_form.find('[name="'+$this.data('qf')+'"]');var sp=$('span.wpcf7-cf7_answer_'+$this.data('qf'));qf.on('change',function(event){event.preventDefault();var _val=$(this).val();sp.text(_val);$this.val(_val);});});});jQuery(document).on('click','form.wpcf7-form input:checkbox.wpcf7-acceptance',function(event){var $this=jQuery(this);var parent_fieldset=$this.closest('fieldset.fieldset-cf7mls');if(parent_fieldset.length){var acceptances=jQuery(parent_fieldset).find('input:checkbox.wpcf7-acceptance');if(acceptances.length){cf7mls_toggle_next_btn(acceptances,parent_fieldset);}}});$(document).on('click','.cf7mls_next',function(event){event.preventDefault();var $this=$(this);$this.addClass('sending');current_fs=$this.closest('.fieldset-cf7mls');next_fs=current_fs.next();var form=$this.parent().closest('form.wpcf7-form');var fd=new FormData();$.each(form.find('input[type="file"]'),function(index,el){fd.append($(el).attr('name'),$(el)[0].files[0]);});var other_data=form.serializeArray();$.each(other_data,function(key,input){fd.append(input.name,input.value);});$.ajax({url:cf7mls_object.ajax_url+'?action=cf7mls_validation',type:'POST',data:fd,processData:false,contentType:false,}).done(function(msg){$this.removeClass('sending');var json=$.parseJSON(msg);if(typeof json._cf7mls_db_form_data_id!='undefined'){if(!form.find('input[name="_cf7mls_db_form_data_id"]').length){form.append('');}} if(!json.success){var checkError=0;current_fs.find('.wpcf7-form-control-wrap').removeClass('cf7mls-invalid');current_fs.find('.cf7mls-invalid').removeClass('cf7mls-invalid');current_fs.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove();if(has_response){current_fs.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors');}else{current_fs.find('.wpcf7-response-output.wpcf7-validation-errors').remove();} $.each(json.invalid_fields,function(index,el){if(current_fs.find('input[name="'+index+'"]').length||current_fs.find('input[name="'+index+'[]"]').length||current_fs.find('select[name="'+index+'"]').length||current_fs.find('select[name="'+index+'[]"]').length||current_fs.find('textarea[name="'+index+'"]').length||current_fs.find('textarea[name="'+index+'[]"]').length){checkError=checkError+1;var controlWraps=[$('[name="'+index+'"]',form).parent(),$('[name="'+index+'[]"]',form).parent()];$.each(controlWraps,function(i1,e1){var _c='wpcf7-not-valid-tip';if(e1.hasClass('form-group')){e1.addClass('has-error');_c+=' help-block';} e1.addClass('cf7mls-invalid');e1.find('span.wpcf7-not-valid-tip').remove();e1.append(''+el.reason+'');});}});if(checkError==0){json.success=true;has_response=false;}else{if(current_fs.find('.wpcf7-response-output').length){has_response=true;current_fs.find('.wpcf7-response-output').addClass('wpcf7-validation-errors').show().text(json.message);}else{has_response=false;current_fs.append('