﻿$(document).ready(function() {

    if ($.cookie("showSurvey") != "no") {

        $.blockUI({ message: $('#ero_survey'), css: { width: '380px', cursor: 'default' }, overlayCSS: { cursor: 'default'} });

        $("a#survey_later").bind("click", function(e) {

            e.preventDefault();

            var theData = new Object();
            theData.surveyFunction = "later";

            $.ajax({
                type: "POST",
                url: "/SurveyModalAJAX.aspx",
                data: theData,
                success: function(msg) {
                    $.unblockUI();
                    $('#ero_survey').html(msg);
                },
                error: function() {
                    // error code here?
                }
            });
        });

        $("a#survey_no").bind("click", function(e) {

            $.cookie("showSurvey", "no", { expires: 100 });

            e.preventDefault();

            var theData = new Object();
            theData.surveyFunction = "no";

            $.ajax({
                type: "POST",
                url: "/SurveyModalAJAX.aspx",
                data: theData,
                success: function(msg) {
                    $.unblockUI();
                    $('#ero_survey').html(msg);
                },
                error: function() {
                    // error code here?
                }
            });
        });

        $("a#survey_yes").bind("click", function(e) {

            $.cookie("showSurvey", "no", { expires: 100 });
            var theData = new Object();
            theData.surveyFunction = "no";

            $.ajax({
                type: "POST",
                url: "/SurveyModalAJAX.aspx",
                data: theData,
                success: function(msg) {
                    $.unblockUI();
                    $('#ero_survey').html(msg);
                },
                error: function() {
                    // error code here?
                }
            });
        });

    }
}); 