$(document).ready(function () {

    $(function () {
        $(".txtExpirationDate").datepicker();
    });

    $('.chkExpires').change(
            function () {
                if ($('.chkExpires').is(':checked'))
                    $('.txtExpirationDate').attr('disabled', false);
                else {
                    $('.txtExpirationDate').attr('disabled', true);
                    $('.txtExpirationDate').val('');

                }
            });


    $('.drpChargeType').change(
            function () {
                if ($('.drpChargeType option:selected').val() == "1") {
                    $('.chargeTypeLabel').text('Account Name:');
                    $('.txtChargeType').width(125);
                    $('.txtChargeType').val('');
                }
                else {
                    $('.chargeTypeLabel').text('Purchase Order #:');
                    $('.txtChargeType').width(110);
                    $('.txtChargeType').val('Bill by Mail');
                }
            });


    var me;
    $('.toggle-box', $('.billingMethodRow')).bind("click", function () {
        $('#addNewRow').slideToggle('slow');

        // toggle image icon:
        if ($('#addnewbm-icon').attr('src') == 'images/advadd.png') {
            $('#addnewbm-icon').attr('src', 'images/advrmv.png');
        }
        else {
            $('#addnewbm-icon').attr('src', 'images/advadd.png');
        }

    }).hover(
            function () {
                me = $(this);
                me.css('cursor', 'pointer');
                me.fadeTo(100, 1);
            },
                    function () {
                        me.fadeTo(100, 0.8);
                    }
            );


});

