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.

Code:
    <script>
// 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. 
            e.preventDefault();

            // Triggering bPopup when click event is fired

                $('#element_to_pop_up').bPopup();

                }


            )}


)}

            )}(jQuery);
</script>
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?