var ptyAdminInputPopupSubmitUrl = "";
var ptyAdminInputPopupInput2 = false;
var ptyAdminInputPopupInput3 = false;

$(function () {
    $('.ptyAdminInputPopup').click(function () {
        var title = $(this).attr("title");
        var content = $(this).attr("content");
        var content2 = $(this).attr("content2");
        var content3 = $(this).attr("content3");
        var value = $(this).attr("value");
        // var yesButtonTitle = $(this).attr("yesButtonTitle");
        ptyAdminInputPopupSubmitUrl = $(this).attr("href");

        if (typeof title !== typeof undefined && title !== false) {
            $("#ptyAdminInputPopupDlg_title").text(title);
        }

        if (typeof content !== typeof undefined && content !== false) {
            $("#ptyAdminInputPopupDlg_content").text(content);
        }

        $("div#ptyAdminInputPopupDlg_content2").hide();
        if (typeof content2 !== typeof undefined && content2 !== false) {
            ptyAdminInputPopupInput2 = true;
            $("div#ptyAdminInputPopupDlg_content2").show();
            $("span#ptyAdminInputPopupDlg_content2").text(content2);
        }

        $("div#ptyAdminInputPopupDlg_content3").hide();
        if (typeof content3 !== typeof undefined && content3 !== false) {
            ptyAdminInputPopupInput3 = true;
            $("div#ptyAdminInputPopupDlg_content3").show();
            $("span#ptyAdminInputPopupDlg_content3").text(content3);
        }


        /*
        if (typeof yesButtonTitle !== typeof undefined && yesButtonTitle !== false) {
            $("#ptyConfirm_yesButtonTitle").text(yesButtonTitle);
        }
        */

        $("input[name=ptyAdminInputPopupDlg_input]").val(value);
        $("input[name=ptyAdminInputPopupDlg_input2]").val('');
        $("input[name=ptyAdminInputPopupDlg_input3]").val('');
        $("#ptyAdminInputPopupDlg").modal();
        $("input[name=ptyAdminInputPopupDlg_input]").focus();
        return false;
    });

    $('#ptyAdminInputPopupDlg_ok').click(function () {
        $("#ptyAdminInputPopupDlg").modal('hide');

        if (ptyAdminInputPopupInput3 === true)
            location.href = ptyAdminInputPopupSubmitUrl + "&value=" + $("input[name=ptyAdminInputPopupDlg_input]").val() + "&value2="+ $("input[name=ptyAdminInputPopupDlg_input2]").val() + "&value3="+ $("input[name=ptyAdminInputPopupDlg_input3]").val();
        else if (ptyAdminInputPopupInput3 === true)
            location.href = ptyAdminInputPopupSubmitUrl + "&value=" + $("input[name=ptyAdminInputPopupDlg_input]").val() + "&value2="+ $("input[name=ptyAdminInputPopupDlg_input2]").val();
        else
            location.href = ptyAdminInputPopupSubmitUrl + "&value=" + $("input[name=ptyAdminInputPopupDlg_input]").val();

        return false;
    });
});

