﻿$(function () {

    $('#msgBoxQuestionnaire').bind('dialogclose', function (event) {
        sendQresp("n");
    });


});

function sendQresp(sResp) {
    $.ajax({
        type: "POST",
        url: "/ajax/questresp.php",
        data: "resp=" + escape(sResp),
        success: function (msg) {
            if (sResp == "y")
                window.location = "/questionnaire.php";
            else
                window.location = "/";
        },
        error: function (msg) {
            window.location = "/";
        }
    });

}

$(document).ready(function () {

    $('#msgBoxQuestionnaire').dialog({
        autoOpen: true,
        width: 350,
        modal: true,
        buttons: {
            "Ok": function () {
                sendQresp("y");
                $(this).dialog("close");
                //window.location = "/questionnaire.php";
            },
            "No thanks": function () {
                sendQresp("n");
                $(this).dialog("close");
                //window.location = "/";
            }
        }
    });





    $('#logoutrem').dialog({
        autoOpen: true,
        width: 350,
        modal: true,
        buttons: {
            "Ok": function () {
                $(this).dialog("close");
            }
        }

    });

    //create a bubble popup for each DOM element with class attribute as "text", "button" or "link" and LI, P, IMG elements.
    $('.helptip').CreateBubblePopup({
        position: 'top',
        align: 'center',
        innerHtml: '',
        innerHtmlStyle: {
            color: '#FFFFFF',
            'text-align': 'center', 'font-weight': 'bold'
        },
        themeName: 'all-blue',
        themePath: 'jquery_extras/jquerybubblepopup-theme'
    });

    //$('.yearmask').mask("9999");
    //$('.onedigitnum').mask("9");
});

