/*
 * Product Purchase - Module
 */
jQuery( function ( $ ) {
    var ProductPurchaseScripts = {
        init : function () {
            this.show_or_hide_for_global_level_settings() ;
            this.show_or_hide_for_global_level_settings_applicable_for() ;
            this.show_or_hide_for_bulk_update_for_buying_point_is_applicable_for() ;
            this.show_or_hide_for_enable_buying_points() ;
            this.show_or_hide_for_hold_product_purchase_points() ;
            this.show_or_hide_for_total_points_that_can_earn_in_cart() ;
            this.show_or_hide_for_cart_custom_message() ;
            this.show_or_hide_for_checkout_custom_message() ;
            this.show_or_hide_for_thankyou_custom_message() ;
            this.show_or_hide_for_enable_earn_point_msg_in_edit_order_page() ;
            this.show_or_hide_for_enable_reward_gateway_error_msg() ;
            this.show_or_hide_for_product_category_selection() ;
            $( document ).on( 'change' , '.rs_enable_product_category_level_for_product_purchase' , this.global_level_settings ) ;
            $( document ).on( 'change' , '#rs_product_purchase_global_level_applicable_for' , this.global_level_settings_applicable_for ) ;
            $( document ).on( 'change' , '#rs_global_enable_disable_sumo_reward' , this.enable_global_level_settings ) ;
            $( document ).on( 'change' , '#rs_buying_points_is_applicable' , this.bulk_update_for_buying_point_is_applicable_for ) ;
            $( document ).on( 'change' , '#rs_enable_buying_points' , this.enable_buying_points ) ;

            $( document ).on( 'change' , '#rs_award_points_for_cart_or_product_total' , this.award_point_based_on ) ;
            $( document ).on( 'change' , '#rs_enable_cart_total_reward_points' , this.enable_cart_total_based_points ) ;
            $( document ).on( 'change' , '#rs_reward_type_for_cart_total' , this.reward_type_for_cart_total ) ;
            $( document ).on( 'change' , '.rs_which_product_selection' , this.product_category_selection ) ;

            $( document ).on( 'change' , '#rs_restrict_days_for_product_purchase' , this.hold_product_purchase_points ) ;
            $( document ).on( 'change' , '#rs_show_hide_minimum_cart_total_earn_error_message' , this.minimum_cart_total_error ) ;
            $( document ).on( 'change' , '#rs_show_hide_maximum_cart_total_earn_error_message' , this.maximum_cart_total_error ) ;
            $( document ).on( 'change' , '#rs_show_hide_total_points_cart_field' , this.total_points_that_can_earn_in_cart ) ;
            $( document ).on( 'change' , '#rs_show_hide_custom_msg_for_points_cart' , this.cart_custom_message ) ;
            $( document ).on( 'change' , '#rs_show_hide_custom_msg_for_points_checkout' , this.checkout_custom_message ) ;
            $( document ).on( 'change' , '#rs_show_hide_custom_msg_for_points_thankyou' , this.thankyou_custom_message ) ;
            $( document ).on( 'change' , '#rs_enable_msg_for_earned_points' , this.enable_earn_point_msg_in_edit_order_page ) ;
            $( document ).on( 'change' , '#rs_disable_point_if_reward_points_gateway' , this.enable_reward_gateway_error_msg ) ;
        } ,
        global_level_settings : function () {
            ProductPurchaseScripts.show_or_hide_for_global_level_settings() ;
        } ,
        show_or_hide_for_global_level_settings : function () {
            if ( jQuery( 'input[name=rs_enable_product_category_level_for_product_purchase]:checked' ).val() == 'no' ) {
                jQuery( '#rs_product_purchase_global_level_applicable_for' ).closest( 'tr' ).show() ;
                jQuery( '#rs_award_points_for_cart_or_product_total' ).closest( 'tr' ).show() ;
                jQuery( '#rs_global_enable_disable_sumo_reward' ).closest( 'tr' ).show() ;
                jQuery( '.rs_hide_bulk_update_for_product_purchase_start' ).hide() ;
                ProductPurchaseScripts.show_or_hide_for_award_point_based_on() ;
            } else {
                jQuery( '#rs_product_purchase_global_level_applicable_for' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '.rs_hide_bulk_update_for_product_purchase_start' ).show() ;
                jQuery( '#rs_award_points_for_cart_or_product_total' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_enable_cart_total_reward_points' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_reward_type_for_cart_total' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_reward_points_for_cart_total_in_fixed' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_reward_points_for_cart_total_in_percent' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_global_enable_disable_sumo_reward' ).closest( 'tr' ).show() ;
                ProductPurchaseScripts.show_or_hide_for_enable_global_level_settings() ;
                jQuery( '#rs_calculate_point_based_on_reg_or_sale' ).closest( 'tr' ).show() ;
                jQuery( '#rs_pointx_not_award_when_sale_price' ).closest( 'tr' ).show() ;
                jQuery( '#rs_restrict_reward' ).closest( 'tr' ).show() ;
                jQuery( '#rs_minimum_cart_total_for_earning' ).closest( 'tr' ).show() ;
                jQuery( '#rs_show_hide_minimum_cart_total_earn_error_message' ).closest( 'tr' ).show() ;
                ProductPurchaseScripts.show_or_hide_for_minimum_cart_total_error() ;
                jQuery( '#rs_show_hide_maximum_cart_total_earn_error_message' ).closest( 'tr' ).show() ;
                jQuery( '#rs_maximum_cart_total_for_earning' ).closest( 'tr' ).show() ;
                ProductPurchaseScripts.show_or_hide_for_maximum_cart_total_error() ;
            }
        } ,
        award_point_based_on : function () {
            ProductPurchaseScripts.show_or_hide_for_award_point_based_on() ;
        } ,
        show_or_hide_for_award_point_based_on : function () {
            if ( jQuery( '#rs_award_points_for_cart_or_product_total' ).val() == '1' ) {
                jQuery( '#rs_enable_disable_reward_point_based_coupon_amount' ).closest( 'tr' ).show() ;
                jQuery( '#rs_enable_cart_total_reward_points' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_reward_type_for_cart_total' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_product_purchase_global_level_applicable_for' ).closest( 'tr' ).show() ;
                jQuery( '#rs_reward_points_for_cart_total_in_fixed' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_reward_points_for_cart_total_in_percent' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_global_enable_disable_sumo_reward' ).closest( 'tr' ).show() ;
                ProductPurchaseScripts.show_or_hide_for_enable_global_level_settings() ;
                ProductPurchaseScripts.show_or_hide_for_global_level_settings_applicable_for() ;
                jQuery( '#rs_calculate_point_based_on_reg_or_sale' ).closest( 'tr' ).show() ;
                jQuery( '#rs_pointx_not_award_when_sale_price' ).closest( 'tr' ).show() ;
                jQuery( '#rs_restrict_reward' ).closest( 'tr' ).show() ;
                jQuery( '#rs_minimum_cart_total_for_earning' ).closest( 'tr' ).show() ;
                jQuery( '#rs_show_hide_minimum_cart_total_earn_error_message' ).closest( 'tr' ).show() ;
                ProductPurchaseScripts.show_or_hide_for_minimum_cart_total_error() ;
                jQuery( '#rs_show_hide_maximum_cart_total_earn_error_message' ).closest( 'tr' ).show() ;
                jQuery( '#rs_maximum_cart_total_for_earning' ).closest( 'tr' ).show() ;
                ProductPurchaseScripts.show_or_hide_for_maximum_cart_total_error() ;
            } else {
                jQuery( '#rs_enable_disable_reward_point_based_coupon_amount' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_enable_cart_total_reward_points' ).closest( 'tr' ).show() ;
                jQuery( '#rs_reward_type_for_cart_total' ).closest( 'tr' ).show() ;
                ProductPurchaseScripts.show_or_hide_for_enable_cart_total_based_points() ;
                jQuery( '#rs_product_purchase_global_level_applicable_for' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_global_enable_disable_sumo_reward' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_global_reward_type' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_global_reward_points' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_global_reward_percent' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_calculate_point_based_on_reg_or_sale' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_pointx_not_award_when_sale_price' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_restrict_reward' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_minimum_cart_total_for_earning' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_show_hide_minimum_cart_total_earn_error_message' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_min_cart_total_for_earning_error_message' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_maximum_cart_total_for_earning' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_show_hide_maximum_cart_total_earn_error_message' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_max_cart_total_for_earning_error_message' ).closest( 'tr' ).hide() ;
            }
        } ,
        enable_cart_total_based_points : function () {
            ProductPurchaseScripts.show_or_hide_for_enable_cart_total_based_points() ;
        } ,
        show_or_hide_for_enable_cart_total_based_points : function () {
            if ( jQuery( '#rs_enable_cart_total_reward_points' ).val() == '1' ) {
                jQuery( '#rs_reward_type_for_cart_total' ).closest( 'tr' ).show() ;
                ProductPurchaseScripts.show_or_hide_for_reward_type_for_cart_total() ;
                jQuery( '#rs_product_purchase_global_level_applicable_for' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
            } else {
                jQuery( '#rs_reward_type_for_cart_total' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_reward_points_for_cart_total_in_fixed' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_reward_points_for_cart_total_in_percent' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_product_purchase_global_level_applicable_for' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
            }
        } ,
        reward_type_for_cart_total : function () {
            ProductPurchaseScripts.show_or_hide_for_reward_type_for_cart_total() ;
        } ,
        show_or_hide_for_reward_type_for_cart_total : function () {
            if ( jQuery( '#rs_reward_type_for_cart_total' ).val() == '1' ) {
                jQuery( '#rs_reward_points_for_cart_total_in_fixed' ).closest( 'tr' ).show() ;
                jQuery( '#rs_reward_points_for_cart_total_in_percent' ).closest( 'tr' ).hide() ;
            } else {
                jQuery( '#rs_reward_points_for_cart_total_in_fixed' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_reward_points_for_cart_total_in_percent' ).closest( 'tr' ).show() ;
            }
        } ,
        global_level_settings_applicable_for : function () {
            ProductPurchaseScripts.show_or_hide_for_global_level_settings_applicable_for() ;
        } ,
        show_or_hide_for_global_level_settings_applicable_for : function () {
            if ( jQuery( '#rs_product_purchase_global_level_applicable_for' ).val() == '1' ) {
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
            } else if ( jQuery( '#rs_product_purchase_global_level_applicable_for' ).val() == '2' ) {
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).show() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
            } else if ( jQuery( '#rs_product_purchase_global_level_applicable_for' ).val() == '3' ) {
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).show() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
            } else if ( jQuery( '#rs_product_purchase_global_level_applicable_for' ).val() == '4' ) {
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
            } else if ( jQuery( '#rs_product_purchase_global_level_applicable_for' ).val() == '5' ) {
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).show() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
            } else {
                jQuery( '#rs_include_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_include_particular_categories_for_product_purchase' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_particular_categories_for_product_purchase' ).closest( 'tr' ).show() ;
            }
        } ,
        enable_global_level_settings : function () {
            ProductPurchaseScripts.show_or_hide_for_enable_global_level_settings() ;
        } ,
        show_or_hide_for_enable_global_level_settings : function () {
            if ( jQuery( '#rs_global_enable_disable_sumo_reward' ).val() == '2' ) {
                jQuery( '.show_if_enable_in_general' ).parent().parent().hide() ;
            } else {
                jQuery( '#rs_global_reward_type' ).parent().parent().show() ;
                if ( jQuery( '#rs_global_reward_type' ).val() == '1' ) {
                    jQuery( '#rs_global_reward_points' ).parent().parent().show() ;
                    jQuery( '#rs_global_reward_percent' ).parent().parent().hide() ;
                } else {
                    jQuery( '#rs_global_reward_points' ).parent().parent().hide() ;
                    jQuery( '#rs_global_reward_percent' ).parent().parent().show() ;
                }

                jQuery( '#rs_global_reward_type' ).change( function () {
                    if ( jQuery( '#rs_global_reward_type' ).val() == '1' ) {
                        jQuery( '#rs_global_reward_points' ).parent().parent().show() ;
                        jQuery( '#rs_global_reward_percent' ).parent().parent().hide() ;
                    } else {
                        jQuery( '#rs_global_reward_points' ).parent().parent().hide() ;
                        jQuery( '#rs_global_reward_percent' ).parent().parent().show() ;
                    }
                } ) ;
            }
        } ,
        bulk_update_for_buying_point_is_applicable_for : function () {
            ProductPurchaseScripts.show_or_hide_for_bulk_update_for_buying_point_is_applicable_for() ;
        } ,
        show_or_hide_for_bulk_update_for_buying_point_is_applicable_for : function () {
            if ( jQuery( '#rs_buying_points_is_applicable' ).val() == '1' ) {
                jQuery( '#rs_include_products_for_buying_points' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_buying_points' ).closest( 'tr' ).hide() ;
            } else if ( jQuery( '#rs_buying_points_is_applicable' ).val() == '2' ) {
                jQuery( '#rs_include_products_for_buying_points' ).closest( 'tr' ).show() ;
                jQuery( '#rs_exclude_products_for_buying_points' ).closest( 'tr' ).hide() ;
            } else {
                jQuery( '#rs_include_products_for_buying_points' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_exclude_products_for_buying_points' ).closest( 'tr' ).show() ;
            }
        } ,
        enable_buying_points : function () {
            ProductPurchaseScripts.show_or_hide_for_enable_buying_points() ;
        } ,
        show_or_hide_for_enable_buying_points : function () {
            if ( jQuery( '#rs_enable_buying_points' ).val() == 'no' ) {
                jQuery( '#rs_points_for_buying_points' ).closest( 'tr' ).hide() ;
            } else {
                jQuery( '#rs_points_for_buying_points' ).closest( 'tr' ).show() ;
            }
        } ,
        hold_product_purchase_points : function () {
            ProductPurchaseScripts.show_or_hide_for_hold_product_purchase_points() ;
        } ,
        show_or_hide_for_hold_product_purchase_points : function () {
            if ( jQuery( '#rs_restrict_days_for_product_purchase' ).is( ':checked' ) ) {
                jQuery( '#rs_restrict_product_purchase_cron_type' ).closest( 'tr' ).show() ;
                jQuery( '#rs_restrict_product_purchase_time' ).closest( 'tr' ).show() ;
            } else {
                jQuery( '#rs_restrict_product_purchase_cron_type' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_restrict_product_purchase_time' ).closest( 'tr' ).hide() ;
            }
        } ,
        minimum_cart_total_error : function () {
            ProductPurchaseScripts.show_or_hide_for_minimum_cart_total_error() ;
        } ,
        show_or_hide_for_minimum_cart_total_error : function () {
            if ( jQuery( '#rs_show_hide_minimum_cart_total_earn_error_message' ).val() == '1' ) {
                jQuery( '#rs_min_cart_total_for_earning_error_message' ).closest( 'tr' ).show() ;
            } else {
                jQuery( '#rs_min_cart_total_for_earning_error_message' ).closest( 'tr' ).hide() ;
            }
        } ,
        maximum_cart_total_error : function () {
            ProductPurchaseScripts.show_or_hide_for_maximum_cart_total_error() ;
        } ,
        show_or_hide_for_maximum_cart_total_error : function () {
            if ( jQuery( '#rs_show_hide_maximum_cart_total_earn_error_message' ).val() == '1' ) {
                jQuery( '#rs_max_cart_total_for_earning_error_message' ).closest( 'tr' ).show() ;
            } else {
                jQuery( '#rs_max_cart_total_for_earning_error_message' ).closest( 'tr' ).hide() ;
            }
        } ,
        total_points_that_can_earn_in_cart : function () {
            ProductPurchaseScripts.show_or_hide_for_total_points_that_can_earn_in_cart() ;
        } ,
        show_or_hide_for_total_points_that_can_earn_in_cart : function () {
            if ( jQuery( '#rs_show_hide_total_points_cart_field' ).val() == '1' ) {
                jQuery( '#rs_total_earned_point_caption' ).closest( 'tr' ).show() ;
                jQuery( '#rs_show_hide_equivalent_price_for_points_cart' ).closest( 'tr' ).show() ;
            } else {
                jQuery( '#rs_total_earned_point_caption' ).closest( 'tr' ).hide() ;
                jQuery( '#rs_show_hide_equivalent_price_for_points_cart' ).closest( 'tr' ).hide() ;
            }
        } ,
        cart_custom_message : function () {
            ProductPurchaseScripts.show_or_hide_for_cart_custom_message() ;
        } ,
        show_or_hide_for_cart_custom_message : function () {
            if ( jQuery( '#rs_show_hide_custom_msg_for_points_cart' ).val() == '1' ) {
                jQuery( '#rs_custom_message_for_points_cart' ).closest( 'tr' ).show() ;
            } else {
                jQuery( '#rs_custom_message_for_points_cart' ).closest( 'tr' ).hide() ;
            }
        } ,
        checkout_custom_message : function () {
            ProductPurchaseScripts.show_or_hide_for_checkout_custom_message() ;
        } ,
        show_or_hide_for_checkout_custom_message : function () {
            if ( jQuery( '#rs_show_hide_custom_msg_for_points_checkout' ).val() == '1' ) {
                jQuery( '#rs_custom_message_for_points_checkout' ).closest( 'tr' ).show() ;
            } else {
                jQuery( '#rs_custom_message_for_points_checkout' ).closest( 'tr' ).hide() ;
            }
        } ,
        thankyou_custom_message : function () {
            ProductPurchaseScripts.show_or_hide_for_thankyou_custom_message() ;
        } ,
        show_or_hide_for_thankyou_custom_message : function () {
            if ( jQuery( '#rs_show_hide_custom_msg_for_points_thankyou' ).val() == '1' ) {
                jQuery( '#rs_custom_message_for_points_thankyou' ).closest( 'tr' ).show() ;
            } else {
                jQuery( '#rs_custom_message_for_points_thankyou' ).closest( 'tr' ).hide() ;
            }
        } ,
        enable_earn_point_msg_in_edit_order_page : function () {
            ProductPurchaseScripts.show_or_hide_for_enable_earn_point_msg_in_edit_order_page() ;
        } ,
        show_or_hide_for_enable_earn_point_msg_in_edit_order_page : function () {
            if ( jQuery( '#rs_enable_msg_for_earned_points' ).is( ":checked" ) ) {
                jQuery( '#rs_msg_for_earned_points' ).parent().parent().show() ;
            } else {
                jQuery( '#rs_msg_for_earned_points' ).parent().parent().hide() ;
            }
        } ,
        enable_reward_gateway_error_msg : function () {
            ProductPurchaseScripts.show_or_hide_for_enable_reward_gateway_error_msg() ;
        } ,
        show_or_hide_for_enable_reward_gateway_error_msg : function () {
            if ( jQuery( '#rs_disable_point_if_reward_points_gateway' ).is( ':checked' ) ) {
                jQuery( '#rs_restriction_msg_for_reward_gatweway' ).closest( 'tr' ).show() ;
            } else {
                jQuery( '#rs_restriction_msg_for_reward_gatweway' ).closest( 'tr' ).hide() ;
            }
        } ,
        product_category_selection : function () {
            ProductPurchaseScripts.show_or_hide_for_product_category_selection() ;
        } ,
        show_or_hide_for_product_category_selection : function () {
            if ( ( jQuery( '.rs_which_product_selection' ).val() === '1' ) ) {
                jQuery( '#rs_select_particular_products' ).parent().parent().hide() ;
                jQuery( '#rs_select_particular_categories' ).parent().parent().hide() ;
            } else if ( jQuery( '.rs_which_product_selection' ).val() === '2' ) {
                jQuery( '#rs_select_particular_products' ).parent().parent().show() ;
                jQuery( '#rs_select_particular_categories' ).parent().parent().hide() ;
            } else if ( jQuery( '.rs_which_product_selection' ).val() === '3' ) {
                jQuery( '#rs_select_particular_products' ).parent().parent().hide() ;
                jQuery( '#rs_select_particular_categories' ).parent().parent().hide() ;
            } else {
                jQuery( '#rs_select_particular_categories' ).parent().parent().show() ;
                jQuery( '#rs_select_particular_products' ).parent().parent().hide() ;
            }
        } ,
    } ;
    ProductPurchaseScripts.init() ;
} ) ;