/*
 * This file belongs to the YIT Framework.
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */
jQuery(document).ready(function($) {

    $('body').yit_popup({
        content : $('.yit-popup-container').html()
    });

    $('body').on('close.yit-popup', function(){
        console.log('close.yit-popup');
        if ($('input.no-view').is(':checked')) {
            $.cookie(yit_newsletter_popup_var.never_show_again_cookie_name, '1',{ expires: 365, path: '/' })
        }
        else{
            $.cookie(yit_newsletter_popup_var.show_next_time_cookie_name, '1',{ path: '/' })
        }

        $('#yithider_yit-popup').on('click',function(){
            $.cookie(yit_newsletter_popup_var.never_show_again_cookie_name, '1',{ expires: 365, path: '/' })
        });
    });

    $('#yit-popup-newsletter-form_yit-popup').submit(function(e){
        $.cookie(yit_newsletter_popup_var.never_show_again_cookie_name, '1',{ expires: 365, path: '/' });
    });

    $('#yithider_yit-popup').on('click', function(){
        $.cookie(yit_newsletter_popup_var.never_show_again_cookie_name, '1',{ expires: 365, path: '/' });
    });

});
