var sayhello var startTime var timer var timeLimit = 5 hideField("cfg_id"); hideField("cfg_eventid"); hideField("cfg_orderid"); if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } if (websiteCountry == "in") { $('#cfg_phone').attr('required', 'true'); $("#label_cfg_phone").show() $("#cfg_phone").show() } $('#cfg_country').on('blur', function() { if ($(this).find('option:selected').val() === "356") { $('#cfg_phone').attr('required', 'true'); $("#label_cfg_phone").show() $("#cfg_phone").show() } }); function hideField(field) { $("#"+ field).css("display", "none"); $("label[for='" + field + "']").css("display", "none"); notMandatory(field); $("#"+ field).removeClass("needs_input"); } function closeLargeFlag() { event.stopPropagation(); $(".contactflag_large").slideUp(400); $(".contactflag").addClass("contactflag_small"); $(".contactflag img").addClass("contactflag_img_small"); } function openLargeFlag() { $(".contactflag_large").slideDown(400); $(".contactflag").removeClass("contactflag_small") $(".contactflag img").removeClass("contactflag_img_small"); document.cookie = "contactform_flag=seen; expires=0; path=/"; } function loadCountries() { if((!user) || (user)) { customerAPI.CountriesNames().then(function (data) { $.each(data, function() { $("#cfg_country").append($("").val(this[0]).text(this[1])); }); }); } } function openContactForm() { closeLargeFlag() $(".contact_wrapper23").css("display", "block").animate({opacity: 1}, 400); document.cookie = "contactform_flag=seen; expires=0; path=/"; loadCountries(); $("body").css("overflow", "hidden") } function closeContactForm() { $(".contact_wrapper23").animate({opacity: 0}, 400) setTimeout(function() { $(".contact_wrapper23").css("display","none") }, 800); $("body").css("overflow", ""); } $(".contactform_close").click(function() { closeContactForm(); }); function validateEmail(mailAddr) { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; if(mailAddr=="") { return false; } return emailReg.test( mailAddr ); } function validateInput(field) { if (field != "cfg_email") { if( ($("#" +field).prop('required')) && !$("#" +field).val() ){ $("#" +field).addClass("needs_input"); check.push(0) } if( ($("#" +field).prop('required')) && $("#" +field).val() ){ $("#" +field).removeClass("needs_input"); check.push(1) } } else { mailAddr = $("#" +field).val(); if (validateEmail(mailAddr) != true) { $("#" +field).addClass("needs_input"); check.push(0) } else { $("#" +field).removeClass("needs_input"); check.push(1) } } } $(".contactform_inner input:not(input[type='radio']):not(input[type='checkbox']), .contactform_inner textarea").focus(function(e){ $("label[for='" + $(this).attr('id') + "']").addClass("label_small"); var container = $('.contact_wrapper23') scrollTo = $(e.target); container.animate({scrollTop: scrollTo.offset().top -50},); }); function startTimer() { if (!startTime ) { startTime = Date.now() } } $('#cfg_firstname, #cfg_lastname, #cfg_country, #cfg_email, #cfg_text').on('input', function() { startTimer() }); $(".contactform_inner input:not(input[type='radio']):not(input[type='checkbox']), .contactform_inner textarea, .contactform_inner select,").focusout(function(){ if(!$(this).val()) { $("label[for='" + $(this).attr('id') + "']").removeClass("label_small"); } else { if ($("#"+ $(this).attr('id')).hasClass("needs_input")) { validateInput($(this).attr('id')); } } }); function makeMandatory(field) { $("#"+ field).attr("required", true); } function notMandatory(field) { $("#"+ field).attr("required", false); $("#"+ field).val(""); $("label[for='" + field + "']").removeClass("label_small"); } function showField(field) { $("#"+ field).slideDown(100); $("label[for='" + field + "']").slideDown(100); makeMandatory(field); } $('.contactform_inner select').change(function() { var select = this.value; if (this.value) { $("#" + $(this).attr('id')).css("color", "#264EC7"); } else{ $("#" + $(this).attr('id')).css("color", ""); } }); $('input[type=radio][name=cfg_customer]').change(function() { var value = $(this).filter(':checked').val(); if ( value == "1" ) { showField("cfg_id"); showField("cfg_topic"); } if ( value == "0" ) { hideField("cfg_id"); hideField("cfg_eventid"); hideField("cfg_orderid"); hideField("cfg_topic"); } }); $('#cfg_topic').change(function() { var question = this.value; if ((question=="software") || (question=="hardware") ) { hintKB(); } if (question =="software") { showField("cfg_eventid"); } else { hideField("cfg_eventid"); } if (question=="order") { showField("cfg_orderid"); } else { hideField("cfg_orderid"); } }); if ( ($(location).attr('href').indexOf("/shop/") > 0 ) && ($(location).attr('href').indexOf("/help.php/") < 0 ) ) { $(".contactform_form").slideUp(); $(".contactform_kb_hint").append(`
En nuestra sección de preguntas frecuentes encontrará ayuda rápida para la mayoría de las preguntas:
Tengo una pregunta diferente
`); $(".contactform_kb_hint").slideDown(300); } function hintKB(){ if ( ($(location).attr('href').indexOf("/shop/") < 0 ) && ($(location).attr('href').indexOf("/help.php/") < 0 ) ) { $(".contactform_kb_hint").append(`Based on our statistics, more than 68% of the answers to software and hardware support inquiries can be found in our Knowledge Base.
Give it a try!
Simply search for a keyword there to find the quickest possible answer:
Tengo una pregunta diferente
`); $(".contactform_form").slideUp(300); $(".contactform_kb_hint").slideDown(300); } } function kbDifferent() { $(".contactform_form").slideDown(400); $(".contactform_kb_hint").slideUp(400).delay(400).html(""); } function elapsedTime(stop) { start = startTime / 1000 stop = stop/ 1000 timeElapsed = Math.abs(stop - start) return timeElapsed > timeLimit } function sendForm() { check = []; var readyToSend = 0 var honeypot = $('#cfg_subject').val() stopTimer = Date.now() inTimeLimit = elapsedTime(stopTimer) function validateAll() { $(".contactform_inner input:not(input[type='radio']), .contactform_inner textarea, .contactform_inner select,").each(function(){ validateInput($(this).attr('id')); }); if(jQuery.inArray(0, check) < 0) { readyToSend = 1; } else { startTime = false timeLimit = 1 } } validateAll(); if (readyToSend != 0 && honeypot.length == 0 && inTimeLimit){ var cfg_id = $('#cfg_id').val(); var cfg_firstname = $('#cfg_firstname').val(); var cfg_lastname = $('#cfg_lastname').val(); var cfg_email = $('#cfg_email').val(); var cfg_country = $('#cfg_country').val(); var cfg_country_name = $('#cfg_country option:selected').text(); var cfg_topic = $('#cfg_topic').val(); var cfg_text = $('#cfg_text').val().replace(/\r\n|\r|\n/g,"Nos pondremos en contacto con usted en breve. Ha enviado los siguientes datos:
"+confirm_data+"