(function($){
        

       
        $( ".esign_cf7_ratting_widget_yes_button" ).click(function(e) {
                e.preventDefault();
                 var ratting_url = $("#cf7-rating-url").val();
                
                 
              
 
                 $(".esign_cf7_ratting_widget_info").html("That's awesome! Could you please do me a BIG favor and give it a 5-star rating on Wordpress to help us spread the word and boost our motivation?");     
                 $(".esign_cf7_ratting_widget_yes").removeClass("col-sm-1");
                 $(".esign_cf7_ratting_widget_yes").addClass("col-sm-3");
                 $(".esign_cf7_ratting_widget_yes").html("<a onclick='cf7_hide_permanent()' href='"+ratting_url+"' class='button-primary'>OK, you deserve it!</a>"); 
                 $(".esign_cf7_ratting_widget_no").removeClass("col-sm-4");
                 $(".esign_cf7_ratting_widget_no").addClass("col-sm-3");
                 $(".esign_cf7_ratting_widget_no").attr("id","cf7_rating_widget_hide");
                 $(".esign_cf7_ratting_widget_no").html("<a onclick='cf7_hide_permanent()' href='#'>No Thanks</a>"); 
                 $(".esign_monster_icon").removeClass("col-sm-7");
                 $(".esign_monster_icon").addClass("col-sm-6");
     
               
     
     
                });



        
        
    
        $( ".esign_cf7_ratting_widget_no_button" ).click(function(e) {
                e.preventDefault();

                var pluginName = $("#cf7-plugin-name").val();
 
                 $(".esign_cf7_ratting_widget_info").html("We're sorry to hear you aren't enjoying our WP E-Signature and "+pluginName+" integration. We would love a chance to improve. Could you take a minute and let us know what we can do better?");     
                 $(".esign_cf7_ratting_widget_yes").removeClass("col-sm-1");
                 $(".esign_cf7_ratting_widget_yes").addClass("col-sm-2");
                 $(".esign_cf7_ratting_widget_yes").html('<input type="submit" id="esig-cf7-action-ratting-widget" class="button action" onclick="cf7GiveFeedback()" value="Give Feedback">'); 
                 $(".esign_cf7_ratting_widget_no").removeClass("col-sm-4");
                 $(".esign_cf7_ratting_widget_no").addClass("col-sm-3");
                 $(".esign_cf7_ratting_widget_no").attr("id","cf7_rating_widget_hide");                                 
                 $(".esign_cf7_ratting_widget_no").html("<a onclick='cf7_hide_permanent()' href='#'>No Thanks</a>"); 
                 
        }); 


        
        
        
        
	
})(jQuery);


    

function cf7GiveFeedback() {
        var pluginName = document.getElementById('cf7-plugin-name').value;
        cf7_hide_permanent();

        var feedback = document.getElementById('cf7-feedback-url').value;
        window.location.replace(feedback);
} 

function cf7_hide_permanent() {

        var esignRatting = document.getElementById('esign-cf7-ratting');
        esignRatting.parentNode.removeChild(esignRatting);

        var pluginName = document.getElementById('cf7-plugin-name').value;
        
        // Get nonce for security
        var nonce = (typeof esigCf7Ajax !== 'undefined') ? esigCf7Ajax.esig_cf7_nonce : '';
        
        // Send AJAX request with nonce
        var postData = {
            esig_cf7_nonce: nonce
        };
        
        esigRemoteRequest("esig_cf7_ratting_widget_remove", "POST", function(pluginName){
            // Success callback - widget already hidden from UI
        }, postData);
} 
