Fast Modx Callback forms

Код формы с отправкой и валидацией от ботов.

    

    /*
     * 
     * 
     *  Рассчет отступы попапа
     * 
     * 
     */
    
    function calcMarginPopup(popupIdent){
        if(parseInt($(window).height()-($(popupIdent+" .fogContainer").height()+110)) <= 0)
        {
            $(popupIdent+" .fogContainer").css("margin-top","20px");
        }
        else
        {
            $(popupIdent+" .fogContainer").css("margin-top",($(window).height()-$(popupIdent+" .fogContainer").height()-47)/2);
        }
    }
    

[ [ !FormIt?
            &hooks=`email,redirect`
            &emailTpl=`mailTpl`
            &emailSubject=`Сообщения c формы Оставить заявку "Fast Modx Callback forms"`
            &emailTo=``
            &emailFrom=``
            &emailFromName=``
            &validate=`name:required, phone:required, surname:blank`
            &redirectTo=`32`
            &redirectParams=`{"type":"success"}`
            &placeholderPrefix=`feed.`
            &submitVar=`requestInnerSubmit`
        ] ]
Заказать консультации
Спасибо
Мы уже получили ваше сообщение и скоро свяжемся с вами!

jQuery валидация формы и открытие ответа при успешной отправке.

    
$(document).ready(function(){
    
                       
    $("*").click(function(e){
        if($(e.target).closest("#callbackFog .container").length==0 &&$(e.target).closest(".openCallback").length==0) $("#callbackFog").fadeOut();
        if($(e.target).closest("#answerFog .container").length==0) $("#answerFog").fadeOut();
    });
    
    $(".openCallback").click(function(){
        $("#callbackFog").fadeIn();
        $("#callbackFog .container").css("margin-top",($(window).height()-$("#callbackFog .container").height()-47)/2);
    });
    
    $("[name='phone']").mask("+7 (999) 999-99-99");
    
    $(document).on("submit","#callbackForm",function(){
        
        $(this).find(".error").removeClass("error");
        
        if($(this).find("[name='name']").val()==""){
            $(this).find("[name='name']").focus().addClass("error");
            return false;
        }
        
        if($(this).find("[name='phone']").val()==""){
            $(this).find("[name='phone']").focus().addClass("error");
            return false;
        }
       
    });
    
    function getUrlParameter(sParam)
    {
        var sPageURL = window.location.search.substring(1);
        var sURLVariables = sPageURL.split('&');
        for (var i = 0; i < sURLVariables.length; i++) 
        {
            var sParameterName = sURLVariables[i].split('=');
            if (sParameterName[0] == sParam) 
            {
                return sParameterName[1];
            }
        }
    }   
    
    var sendInfo = getUrlParameter('type');
    if(sendInfo=="success"){ 
        $("#answerFog").fadeIn(); 
        $("#answerFog .container").css("margin-top",($(window).height()-$("#answerFog .container").height()-47)/2);
        history.pushState(null, null, window.location.pathname); 
    }   
    
    $(document).on("focus click keyup",".error", function(){
        $(this).removeClass("error");
    });

});
    

Скрипты для скачивания.
jQuery с google
Maskedinput