Initialize Object with different parameters
<p>Hello I have code which replaces <code>document.write</code>, makes a buffer and than pushes buffer into the document:</p>

<pre><code> var lazyLoad = (function () {

    var counter = 0
    var buffer = new Array()
    function work(options){ 
        window.d = document     
        var tmp_buffer
        d.write = d.writeln = function(s){  tmp_buffer += s}

        d.open = d.close = function(){}
        s = d.createElement('script') 
        s.setAttribute('type','text/javascript')
        s.setAttribute('src',options.url)
        d.getElementById(options.block).appendChild(s)

        s.onload = function () {
            buffer[counter] = tmp_buffer
            console.log(buffer[1])
            window.setTimeout(function() {
                d.getElementById(options.block).innerHTML += buffer[counter]            
            }, 0)
            counter++
       }
    }

    return {

            init: function (options) {

                var CONFIG = {
                url: '',
                block: ''
            }

                $.extend(CONFIG, options)

                random = $('#'+CONFIG.block).attr('rel')
                id = $('#'+CONFIG.block).attr('id').replace(random,'')
                id = id.replace('DIV','')
                size = id.split('X')
                ele_width = size[0] || CONFIG.width
                ele_height = size[1] || CONFIG.height

                $('#'+CONFIG.block).css({
                                        'width':ele_width+'px',
                                        'height':ele_height+'px'
                                    })


                $(window).load(function(){
                    if(options.adfox) {
                        random = $('#'+CONFIG.block).attr('id')
                        AdFox_getCodeScript(1, random, CONFIG.url)
                    }else{
                        work(options)
                    }
                })
            }

    }


})();
</code></pre>

<p>If I init it once:</p>

<pre><code>lazyLoad.init({
        'http://test.com/test.js',              
         div1
})
</code></pre>

<p>But if I call it again with other parameters:</p>

<pre><code>lazyLoad.init({
        'http://test2.com/test.js',             
         div2
})
</code></pre>

<p>First init wont work. <code>buffer</code> will be empty. Where is my mistake? </p>
