$(document).on("pageshow", "#page_testpage", function (e) {


    $("#datepicker_test_getdate").unbind().click(function (event) {
        var jsDate = $('#datepicker_test').datepicker('getDate');
        if (jsDate !== null) { // if any date selected in datepicker
            jsDate instanceof Date; // -> true
            var selectedDay = (jsDate.getDate()).toString();
            if (selectedDay.length == 1) {
                selectedDay = '0' + selectedDay;
            }

            var selectedMonth = (jsDate.getMonth() + 1).toString();
            if (selectedMonth.length == 1) {
                selectedMonth = '0' + selectedMonth;
            }

            var dbDate = jsDate.getFullYear().toString() + '-' + selectedMonth + '-' +  selectedDay;
            c8(dbDate);
        }

    });



    $("#popup_test").unbind().click(function (event) {
        //event.preventDefault();
        //event.stopImmediatePropagation();


        $("#testpage_popup_header").html('This is harcoded test header text');
        $("#testpage_popup_text").html('Suspendisse eget convallis tortor. Donec porttitor felis ut vehicula iaculis. Ut feugiat diam augue, tristique varius enim dictum eget. Duis auctor, erat non tempor euismod.');
        $("#testpage_popup").off().on("popupafterclose", function (event, ui) {
            $(":mobile-pagecontainer").pagecontainer("change", "#testpage_popup", { role: "page", reverse: false, changeHash: false });
            e4('finishjobwizard_1 row 119');
        });

        $("#testpage_popup_button").unbind("click").click(function () {
            $("#testpage_popup").popup("close");
        });

        $("#testpage_popup").popup().popup("open");

    });

    $("#testpage_icon_button").unbind().click(function (event) {

        event.preventDefault();

        c1('icon button pressed');
        swapButton($('#testpage_icon_button'));
    });

    
});




