function ModifyCreditCardPopUpWindow() {

    try {
        var mainTable = $("table.formcontent")[0];

        if (!mainTable)
            throw "Main input table not found!";

        //if checkBox allready added break function
        if ($("[id$=chkGetDataFromSubscriber]").length > 0)
            return;

        //get row index from CCV and insert new row below it
        var ccvRow = $("[id$=txtCVV]").parent().parent().index();
        
        //create new row and cells for main table
        var newRow = mainTable.insertRow(ccvRow + 1);
        var cellLabel = newRow.insertCell(0);
        var cellInput = newRow.insertCell(1);

        //set cells style
        cellLabel.style.textAlign = "right";
        cellInput.style.textAlign = "left";
        cellInput.colSpan = 3;

        var newCheckBox = document.createElement('input');
        newCheckBox.type = "checkbox";
        newCheckBox.id = "chkGetDataFromSubscriber";
        var textForCheckBoxLabel = document.createTextNode("Use Subscriber Address");

        cellInput.appendChild(newCheckBox);
        cellInput.appendChild(textForCheckBoxLabel);

        $("#chkGetDataFromSubscriber").on('click', function () {
            GetDataFromSubscriberObject();
        });
        
        $("#chkGetDataFromSubscriber").checked = false;

    } catch (e) {
        console.log(e);
    }

}

function GetDataFromSubscriberObject() {

    if ($("#chkGetDataFromSubscriber")[0] && $("#chkGetDataFromSubscriber")[0].checked) {

        var firstnameSubscriber = $("[id*=EnrollCustomerControl][id$=m_txtFirstName]")[0];
        var firstname = $("[id*=EnrollCustomerControl][id*=ctlUpdateCreditCard][id$=txtFirstName]")[0];
        if (firstnameSubscriber && firstname)
            firstname.value = firstnameSubscriber.value;

        var middleNameSubscriber = $("[id*=EnrollCustomerControl][id$=m_txtMiddleName]")[0];
        var middleName = $("[id*=EnrollCustomerControl][id*=ctlUpdateCreditCard][id$=txtMiddleName]")[0];
        if (middleNameSubscriber && middleName)
            middleName.value = middleNameSubscriber.value;

        var lastnameSubscriber = $("[id*=EnrollCustomerControl][id$=m_txtLastName]")[0];
        var lastname = $("[id*=EnrollCustomerControl][id*=ctlUpdateCreditCard][id$=txtLastName]")[0];
        if (lastnameSubscriber && lastname)
            lastname.value = lastnameSubscriber.value;

        var txtAddress1Subscriber = $("[id*=EnrollCustomerControl][id$=m_txtAddress1]")[0];
        var txtAddress1 = $("[id*=EnrollCustomerControl][id*=ctlUpdateCreditCard][id$=txtAddress1]")[0];
        if (txtAddress1Subscriber && txtAddress1)
            txtAddress1.value = txtAddress1Subscriber.value;

        var txtAddress2Subscriber = $("[id*=EnrollCustomerControl][id$=m_txbAddress2]")[0];
        var txtAddress2 = $("[id*=EnrollCustomerControl][id*=ctlUpdateCreditCard][id$=txtAddress2]")[0];
        if (txtAddress2Subscriber && txtAddress2)
            txtAddress2.value = txtAddress2Subscriber.value;

        var txtCitySubscriber = $("[id*=EnrollCustomerControl][id$=m_txtCity]")[0];
        var txtCity = $("[id*=EnrollCustomerControl][id*=ctlUpdateCreditCard][id$=txtCity]")[0];
        if (txtCitySubscriber && txtCity)
            txtCity.value = txtCitySubscriber.value;

        var txtEmailSubscriber = $("[id*=EnrollCustomerControl][id$=m_txbEmailAddress]")[0];
        var txtEmail = $("[id*=EnrollCustomerControl][id*=ctlUpdateCreditCard][id$=txtEmail]")[0];
        if (txtEmailSubscriber && txtEmail)
            txtEmail.value = txtEmailSubscriber.value;

    }

}