how to destroy jquery addon so it can be re-generated
<p>I am using a image map, and added an addon to map full screen however when it goes to full screen it generates it again so i need to destroy the previous and re-generate it as its placing it twice and does not working correctly but cannot work it out - any ideas? the JS is below:</p>

<pre><code>    $(function(){

    $('.map').craftmap({
        image: {
            width: 1994,
            height: 1303
        }
    });

    $('.full-screen a').click(function(e){
            $('.relative').fullScreen({
                'callback': function(isFullScreen){
                    $('.map').addClass('fullscreenmap');
                    $('.map').craftmap({
                        fullscreen: true,
                        image: {
                            width: 1994,
                            height: 1303
                        }
                    });
                }
            });
    });

    $('.full-screen a').toggle(function (){
            $('.full-screen a').text("Close").stop();
    }, function(){
            $('.full-screen a').text("Full Screen").stop();
    });

});
</code></pre>

<p>The addon is below, as might need something adding to it to perform this task?</p>

<pre><code>    (function($){
    $.fn.craftmap = function(options) {
        var D = {
            cookies: false,
            fullscreen: false,
            container: {
                name: 'imgContent'
            },
            image: {
                width: 1475,
                height: 1200,
                name: 'imgMap'
            },
            map: {
                position: 'center'
            },
            marker: {
                name: 'marker',
                center: true,
                popup: true,
                popup_name: 'popup',
                onClick: function(marker, popup){},
                onClose: function(marker, popup){}
            },
            controls: {
                init: true,
                name: 'controls',
                onClick: function(marker){}
            },
            preloader: {
                init: true,
                name: 'preloader',
                onLoad: function(img, dimensions){}
            }
        }; // default settings

        var S = $.extend(true, D, options); 

        return this.each(function(){
            var M = $(this),
                IMG = M.find('.'+S.image.name),
                P = {
                    init: function(){
                        this._container.init();
                        if (S.fullscreen) {
                            this.fullscreen.init();
                            this.fullscreen.resize();
                        }
                        this._globals.init();
                        if (S.preloader.init) this.preloader.init();
                        this.map.init();
                        this.marker.init();
                        if (S.controls.init) this.controls.init();
                    },
                    _container: {
                        init: function(){
                            P._container.css();
                            P._container.wrap();
                        },
                        css: function(){
                            var max = {
                                    width: '100%',
                                    height: '100%'
                                };
                            IMG.css(max);
                            var css = {
                                position: 'relative', 
                                overflow: 'hidden', 
                                cursor: 'move'
                            }
                            M.css(css);
                        },
                        wrap: function(){
                            var css = {
                                zIndex: '1', 
                                position: 'absolute',
                                width: S.image.width,
                                height: S.image.height
                            }
                            M.wrapInner($('&lt;div /&gt;').addClass(S.container.name).css(css));
                        }
                    },
                    _globals: {
                        init: function(){
                            C = M.find('.'+S.container.name),
                            MARKER = C.find('.'+S.marker.name),
                            md = false, mx = 0, my = 0, ex = 0, ey = 0, delta = 0, mv = [], interval = 0,
                            D = {
                                w: M.width(),
                                h: M.height()
                            },
                            I = {
                                w: C.width(),
                                h: C.height()
                            }
                            if (S.controls.init){
                                CONTROLS = $('.'+S.controls.name).find('a');
                            }
                        }
                    },
                    _mouse: {
                        get: function(e){
                            var x = e.pageX,
                                y = e.pageY; 
                            return {'x': x, 'y': y}
                        },
                        update: function(e){
                            var mouse = P._mouse.get(e),
                                x = mouse.x,
                                y = mouse.y,
                                movex = x-mx,
                                movey = y-my,
                                top = ey+movey,
                                left = ex+movex,
                                check = P.map.position.check(left, top),
                                css = {
                                    top: check.y,
                                    left: check.x
                                }
                            C.css(css);
                            if (S.cookies){
                                P.cookies.create('position', check.x + ',' + check.y, 7);
                            }
                        },
                        decelerate: function(e){
                            var l = mv.length, timer = 0;
                            if (l){
                                var tc = 20;
                                interval = setInterval(function(){
                                    var position = C.position(), left = position.left, top = position.top,
                                        remain = (tc-timer)/tc,
                                        last = l-1,
                                        xd = (mv[last].x-mv[0].x)/l,
                                        yd = (mv[last].y-mv[0].y)/l,
                                        vx = xd*remain,
                                        vy = yd*remain,
                                        coords = P.map.position.check(vx+left, vy+top),
                                        css = {
                                            left: coords.x,
                                            top: coords.y
                                        };
                                    C.css(css); 
                                    ++timer;
                                    if (timer == tc){
                                        clearInterval(interval);
                                        timer = 0;
                                    }
                                }, 40); 
                            }
                        },
                        wheel: {
                            init: function(e){
                                M.handle = function(e){
                                    e.preventDefault();
                                    if (!e) {
                                        e = window.event;
                                    }
                                    if (e.wheelDelta) {
                                        delta = e.wheelDelta/120;
                                        if (window.opera) {
                                            delta = -delta;
                                        }
                                    } else if (e.detail) {
                                        delta = -e.detail/3;
                                    }
                                }
                                if (window.addEventListener){
                                    window.addEventListener('DOMMouseScroll', M.handle, false);
                                }   
                                window.onmousewheel = document.onmousewheel = M.handle;
                            },
                            remove: function(){
                                if (window.removeEventListener){
                                    window.removeEventListener('DOMMouseScroll', M.handle, false);
                                }
                                window.onmousewheel = document.onmousewheel = null;
                            }
                        }
                    },
                    fullscreen: {
                        init: function(){
                            var win = $(window), w = win.width(), h = win.height(),
                                css = {
                                    width: w,
                                    height: h
                                }
                            M.css(css);
                        },
                        resize: function(){
                            $(window).resize(function(){
                                P.fullscreen.init();
                                D = {
                                    w: M.width(),
                                    h: M.height()
                                }
                            });
                        }
                    },
                    cookies: {
                        create: function(name, value, days) {
                            if (days) {
                                var date = new Date(), set = date.getTime() + (days * 24 * 60 * 60 * 1000);
                                date.setTime(set);
                                var expires = '; expires=' + date.toGMTString();
                            } else {
                                var expires = '';
                            }
                            document.cookie = name+'='+value+expires+'; path=/';
                        },
                        erase: function(name) {
                            cookies.create(name, '', -1);
                        },
                        read: function(name) {
                            var e = name + '=',
                                ca = document.cookie.split(';');
                            for(var i=0;i &lt; ca.length;i++) {
                                var c = ca[i];
                                while (c.charAt(0) == ' '){
                                    c = c.substring(1, c.length);
                                }
                                if (c.indexOf(e) == 0){
                                    return c.substring(e.length,c.length);
                                }
                            }
                            return null;
                        }
                    },
                    preloader: {
                        init: function(){
                            var img = new Image(),
                                src = IMG.attr('src');
                            P.preloader.create();
                            $(img).addClass(S.image.name).attr('src', src).load(function(){
                                var t = $(this),
                                    css = {
                                        width: this.width,
                                        height: this.height
                                    }
                                t.css(css);
                                IMG.remove();
                                P.preloader.remove();
                                S.preloader.onLoad.call(this, t, css);
                            }).appendTo(C);
                        },
                        create: function(){
                            var css = {
                                position: 'absolute', 
                                zIndex: '10', 
                                top: '0', 
                                left: '0', 
                                width: '100%', 
                                height: '100%'
                            }
                            M.append($('&lt;div /&gt;').addClass(S.preloader.name).css(css));
                        },
                        remove: function(){
                            M.find('.'+S.preloader.name).fadeOut(400, function(){
                                var t = $(this);
                                t.remove();
                            });
                        }
                    },
                    map: {
                        init: function(){
                            P.map.position.set();
                            P.map.move();
                        },
                        position: {
                            set: function(){
                                if (S.cookies){
                                    if (typeof P.cookies.read('position') != 'null') {
                                        var position = P.cookies.read('position').split(','), 
                                            x = position[0], 
                                            y = position[1];
                                    } else {
                                        var x = (D.w-I.w)/2, 
                                            y = (D.h-I.h)/2;
                                    }
                                } else {
                                    var position = S.map.position;
                                    switch (position){
                                        case 'center':
                                            var x = (D.w-I.w)/2,
                                                y = (D.h-I.h)/2;
                                            break;
                                        case 'top_left':
                                            var x = 0,
                                                y = 0;
                                            break;
                                        case 'top_right':
                                            var x = D.w-I.w,
                                                y = 0;
                                            break;
                                        case 'bottom_left':
                                            var x = 0,
                                                y = D.h-I.h;
                                            break;
                                        case 'bottom_right':
                                            var x = D.w-I.w,
                                                y = D.h-I.h;
                                            break;
                                        default:
                                            var coords = position.split(' '),
                                                x = -(coords[0]),
                                                y = -(coords[1]),
                                                coords = P.map.position.check(x, y),
                                                x = coords.x,
                                                y = coords.y;
                                    }   
                                }
                                var css = { top: y, left: x }
                                C.css(css);
                            },
                            check: function(x, y){
                                if (y &lt; (D.h-I.h)){
                                    y = D.h-I.h;
                                } else if (y &gt; 0){
                                    y = 0;
                                }

                                if (x &lt; (D.w-I.w)){
                                    x = D.w-I.w;
                                } else if (x&gt;0){
                                    x = 0;
                                }
                                return {'x': x, 'y': y}
                            }
                        },
                        move: function(){
                            C.bind({
                                mousedown: function(e){
                                    md = true;
                                    var mouse = P._mouse.get(e);
                                        mx = mouse.x,
                                        my = mouse.y;
                                    var el = C.position();
                                        ex = el.left,
                                        ey = el.top;
                                        mv = [];
                                        clearInterval(interval);
                                    P._mouse.update(e);
                                    return false;
                                },
                                mousemove: function(e){
                                    if (md) {
                                        P._mouse.update(e);
                                        var mouse =  P._mouse.get(e),
                                            coords = {
                                                x: mouse.x,
                                                y: mouse.y
                                            }
                                        mv.push(coords);
                                        if (mv.length &gt; 15){
                                            mv.pop();
                                        }   
                                    }
                                    return false;
                                },
                                mouseup: function(e){
                                    if (md) md = false;
                                    P._mouse.decelerate(e);
                                    return false;
                                },
                                mouseout: function(){
                                    if (md) md = false;
                                    P._mouse.wheel.remove();
                                    return false;
                                },
                                mouseover: function(e){
                                    P._mouse.wheel.init(e);
                                    return false;
                                },
                                mousewheel: function(e){
                                    P._zoom.init(e);
                                }
                            });
                        }
                    },
                    _zoom: {
                        init: function(e){}
                    },
                    marker: {
                        init: function(){
                            P.marker.set();
                            P.marker.open();
                            P.marker.close();
                        },
                        set: function(){
                            MARKER.each(function(){
                                var t = $(this), position = t.attr('data-coords').split(',');
                                    x = parseInt(position[0]), y = parseInt(position[1]),
                                    css = {
                                        position: 'absolute',
                                        zIndex: '2',
                                        top: y,
                                        left: x
                                    }
                                t.css(css);
                            }).wrapInner($('&lt;div /&gt;').addClass(S.marker.name+'Content').hide());
                        },
                        open: function(){
                            MARKER.live('click', function(){
                                var t = $(this), id = t.attr('id'), marker = S.marker, w = t.width(), h = t.height(),
                                    position = t.position(), x = position.left, y = position.top, id = t.attr('id'),
                                    html = t.find('.'+marker.name+'Content').html();

                                if (marker.center){
                                    var cy = -y+D.h/2-h/2,
                                        cx = -x+D.w/2-w/2,
                                        c = P.map.position.check(cx, cy),
                                        animate = {
                                            top: c.y,
                                            left: c.x
                                        };
                                    C.animate(animate);
                                }

                                if (marker.popup){
                                    $('.'+marker.popup_name).remove();
                                    var css = {
                                        position:'absolute', 
                                        zIndex:'3'
                                    }
                                    t.after(
                                        $('&lt;div /&gt;').addClass(marker.popup_name+' '+id).css(css).html(html).append(
                                            $('&lt;a /&gt;').addClass('close')
                                        )
                                    );
                                    var POPUP = t.next('.'+marker.popup_name), 
                                        pw = POPUP.innerWidth(), 
                                        ph = POPUP.innerHeight(),
                                        x0 = 0, y0 = 0;

                                    if (x-pw &lt; 0){
                                        x0 = x;
                                    } else if (x+pw/2 &gt; I.w){
                                        x0 = x-pw+w;
                                    } else {
                                        x0 = x-(pw/2-w/2);
                                    }

                                    if (y-ph &lt; 0){
                                        y0 = y+h+h/1.5;
                                    } else {
                                        y0 = y-ph-h/1.5;
                                    }

                                    if (x-pw &lt; 0 &amp;&amp; y-ph &lt; 0){
                                        x0 = x+w*2;
                                        y0 = y-h/2;
                                    } else if (y-ph &lt; 0 &amp;&amp; x+pw/2 &gt; I.w){
                                        x0 = x-pw-w/2;
                                        y0 = y-h/2;
                                    } else if (y+ph &gt; I.h &amp;&amp; x+pw/2 &gt; I.w){
                                        x0 = x-pw+w;
                                        y0 = y-ph-h/2;
                                    } else if (y+ph &gt; I.h &amp;&amp; x-pw &lt; 0){
                                        x0 = x;
                                        y0 = y-ph-h/2;
                                    }

                                    var css = {
                                            left: x0,
                                            top: y0
                                        }
                                    POPUP.css(css);
                                }
                                P.controls.active.set(id);
                                marker.onClick.call(this, t, POPUP); 
                                return false;
                            });
                        },
                        close: function(){
                            C.find('.close').live('click', function(){
                                var t = $(this), popup = t.parents('.'+S.marker.popup_name), marker = popup.prev('.'+S.marker.name);
                                popup.remove();
                                P.controls.active.remove();
                                S.marker.onClose.call(this, marker, popup);
                                return false;
                            });
                        }
                    },
                    controls: {
                        init: function(){
                            P.controls.set();
                        },
                        set: function(){
                            CONTROLS.click(function(){
                                var t = $(this), rel = t.attr('rel');
                                div = C.find('.'+ S.marker.name).filter('#'+rel);
                                div.trigger('click');
                                S.controls.onClick.call(this, div);
                                return false;
                            });
                        },
                        active: {
                            set: function(id){
                                if (S.controls.init){
                                    CONTROLS.removeClass('active').filter(function(){
                                        return this.rel == id;
                                    }).addClass('active');
                                }
                            },
                            remove: function(){
                                if (S.controls.init) {
                                    CONTROLS.removeClass('active');
                                }
                            }
                        }
                    }
                }
            P.init();
        });
    };
}(jQuery));
</code></pre>

<p>Full screen addon</p>

<pre><code> (function($){
    "use strict";

    // These helper functions available only to our plugin scope.
    function supportFullScreen(){
        var doc = document.documentElement;

        return ('requestFullscreen' in doc) ||
                ('mozRequestFullScreen' in doc &amp;&amp; document.mozFullScreenEnabled) ||
                ('webkitRequestFullScreen' in doc);
    }

    function requestFullScreen(elem){
        if (elem.requestFullscreen) {
            elem.requestFullscreen();
        } else if (elem.mozRequestFullScreen) {
            elem.mozRequestFullScreen();
        } else if (elem.webkitRequestFullScreen) {
            elem.webkitRequestFullScreen();
        }
    }

    function fullScreenStatus(){
        return document.fullscreen ||
                document.mozFullScreen ||
                document.webkitIsFullScreen ||
                false;
    }

    function cancelFullScreen(){
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
        }
        $(document).off( 'fullscreenchange mozfullscreenchange webkitfullscreenchange' );
    }

    function onFullScreenEvent(callback){
        $(document).on("fullscreenchange mozfullscreenchange webkitfullscreenchange", function(){
            // The full screen status is automatically
            // passed to our callback as an argument.
            callback(fullScreenStatus());
        });
    }

    // Adding a new test to the jQuery support object
    $.support.fullscreen = supportFullScreen();

    // Creating the plugin
    $.fn.fullScreen = function(props){
        if(!$.support.fullscreen || this.length !== 1) {
            // The plugin can be called only
            // on one element at a time

            return this;
        }

        if(fullScreenStatus()){
            // if we are already in fullscreen, exit
            cancelFullScreen();
            return this;
        }

        // You can potentially pas two arguments a color
        // for the background and a callback function

        var options = $.extend({
            'background'      : '#111',
            'callback'        : $.noop( ),
            'fullscreenClass' : 'fullScreen'
        }, props),

        elem = this,

        // This temporary div is the element that is
        // actually going to be enlarged in full screen

        fs = $('&lt;div&gt;', {
            'css' : {
                'overflow-y' : 'auto',
                'background' : options.background,
                'width'      : '100%',
                'height'     : '100%'
            }
        })
            .insertBefore(elem)
            .append(elem);

        // You can use the .fullScreen class to
        // apply styling to your element
        elem.addClass( options.fullscreenClass );

        // Inserting our element in the temporary
        // div, after which we zoom it in fullscreen

        requestFullScreen(fs.get(0));

        fs.click(function(e){
            if(e.target == this){
                // If the black bar was clicked
                cancelFullScreen();
            }
        });

        elem.cancel = function(){
            cancelFullScreen();
            return elem;
        };

        onFullScreenEvent(function(fullScreen){
            if(!fullScreen){
                // We have exited full screen.
                // Remove the class and destroy
                // the temporary div

                elem.removeClass( options.fullscreenClass ).insertBefore(fs);
                fs.remove();
            }

            // Calling the user supplied callback
            options.callback(fullScreen);
        });

        return elem;
    };

    $.fn.cancelFullScreen = function( ) {
            cancelFullScreen();

            return this;
    };
}(jQuery));
</code></pre>
