I am making a popup system with bPopup with an iFrame loaded and I would like to load the popup only if it hasn't been loaded yet. Here is the part of the code that, in my opinion, should do it, but somehow it doesn't work.

// Semicolon (;) to ensure closing of earlier scripting
// Encapsulation
// $ is assigned to jQuery
        var cvalue = $.cookie('xVisited');
        if (cvalue != 'true') {
        $.cookie('xVisited', 'true');
        (function($) {

        $(window).bind('load', function (e) {
     // DOM Ready
    $(function() {

        // Binding a click event
        // From jQuery v.1.7.0 use .on() instead of .bind()

            // Prevents the default action to be triggered. 

            // Triggering bPopup when click event is fired





I see this error message: "Uncaught TypeError: Object function (e,t){return new st.fn.init(e,t,X)} has no method 'cookie'"

Do you have any idea what I need to change in order to make it work?