<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">$(document)
       .ready(function () {
        debugger;
           var sqzePgaeAllowed = $("#sqpstat").val();
           //Hide lock in the school section
           $('#signup-sqzpage').hide();
           //check the status of squeeze pages : allowed or blocked by the agent
           if (sqzePgaeAllowed == "True")
           {
               //school info show or hide
               if (!cookiesExists()) {
                   console.log('document pannel');
                   $('#signup-sqzpage').show();
                   $('#schoolInfoContainter').hide();
               }

               $(document)
                .on('click',
                    function(evt) {                        
                        //alert('squuez page allowed');

                        //UC details page

                        if ($(evt.target).parents("#schoolinfo").length) {                       
                            ShowLeadModalInDetailsPage();
                        }

                        //UC Slider picture : Full screen 
                        if ($(evt.target).parents(".rsFullscreenBtn").length) {
                            //alert('full screen clicked');
                            ShowLeadModalInDetailsPage();
                        }
                        //UC Slider picture : right arrow click 
                        if ($(evt.target).parents(".rsArrowRight").length) {
                                               
                            ShowLeadModalInDetailsPage();
                        }
                        //UC Slider picture : left arrow click 

                        if ($(evt.target).parents(".rsArrowLeft").length) {
                         
                            ShowLeadModalInDetailsPage();
                        }

                        if ($(evt.target).parents(".doc-items").length) {
                           
                            // alert('left click clicked');
                            ShowLeadModalInDetailsPage();
                            evt.preventDefault();
                        }
                       

                    });
        }

    });


function ShowLeadModalInDetailsPage() {
    //alert('show popup');
    var awid = $("#awid").val();
    var listingid = $("#lid").val();
    //check if the cookies exists   
    if (!cookiesExists()) {
        //alert("cookies doesn't exisit");
        displaySqueezePagePopup(awid, listingid);
    }
        
}

/*Open Popup from Details page*/
function cookiesExists()
{  
   
  
    if ($.cookie("sqpzstat"))
    {
        console.log('cookies exists');
        return true;
    }
    return false;
    //if ($.cookie("sqpzstat") == null)
    //{
    //    // if cookie doesn't exist     
    //    $.cookie("sqpzstat", "true");
    //    return false;

    //}
}
function createCookies()
{
    console.log('create cookies');

    if ($.cookie("sqpzstat") == null) {
        // if cookie doesn't exist     
        $.cookie("sqpzstat", "true",{ path: '/' });
   

    }
}
function deletecookie()
{
    var acookie = getCookie("sqpzstat");
    if (!acookie) {
        alert("Cookie not found.");
    } else {
        $.removeCookie("sqpzstat");
        //$.cookie("caputurePopup", null);
    }

}
function getCookie(c_name) {
    var c_value = document.cookie,
        c_start = c_value.indexOf(" " + c_name + "=");
    if (c_start == -1) c_start = c_value.indexOf(c_name + "=");
    if (c_start == -1) {
        c_value = null;
    } else {
        c_start = c_value.indexOf("=", c_start) + 1;
        var c_end = c_value.indexOf(";", c_start);
        if (c_end == -1) {
            c_end = c_value.length;
        }
        c_value = unescape(c_value.substring(c_start, c_end));
    }
    return c_value;
}

function displaySqueezePagePopup(awid, listingid) {
    console.log('display popup');
    var DetailPostBackURL = '/Pages/SqueezePagePopup';
    var options = { "backdrop": "static", keyboard: true };
    $.ajax({
        type: "GET",
        url: DetailPostBackURL,
        contentType: "application/json; charset=utf-8",
        data: { "agentWebsiteId": awid, "listingid": listingid },
        datatype: "json",
        success: function (data) {
           // debugger;
            $('#LeadCaptureModal').html(data);
            //$('#LeadCaptureModal').dialog({
           
            //    width: 900 });
            $('#LeadCaptureModal').modal(options);
            $('#LeadCaptureModal').modal('show');

        },
        error: function () {
            alert("Dynamic content load failed.");
        }
    });
}
function submitSqueezefrm(btnClicked) {

    var parentNodeObj = $(btnClicked).parents('form:first').parent();



    //Form Submit
    var formData = $(btnClicked).parents('form');
    console.log('Disabled Btn');
    //$(btnClicked).button('loading');


    formData.submit(function (e) {

        $("#sendemail").hide();
        $("#pleaseWaitSeding").show();
        $(btnClicked).attr('disabled', true);
        $.ajax({
            url: "/Pages/SubmitSqueezePageForm",
            type: "POST",
            data: formData.serialize(),
            success: function (result) {
                debugger;              
                $("#LeadCaptureModal").html(result);              
                var success = $('#success_msg');
                var failure = $('#failure_msg');
                if (success.length &gt; 0) {
                    // exists.
                    //create cookies and log the status of the popup
                    createCookies();
                    //remove lock and show school info section instead
                    $('#signup-sqzpage').hide();
                    $('#schoolInfoContainter').show();

                } else {
                    
                }
                setTimeout(function () {
                    $('#LeadCaptureModal').modal('hide');
                }, 6000);


                // Hide Spinner after submit
                $("#sendemail").show();
                $("#pleaseWaitSeding").hide();
                $(btnClicked).attr('disabled', false);
            },
            error: function (result) {
            }
        });
        e.preventDefault();
    });
}

$('#LeadCaptureModal').on('hidden', function () {
    $(this).data('modal').$element.removeData();
})</pre></body></html>