How to initialize once and pass that same value to another function again and again?
<p>Consider the following function . This will be called everytime the browser is resized and every time I want to pass the same initial value of the <code>this.original_ul</code> to this function <code>doLayout()</code> . It is computed only once inside an initialization function separately . Right now what is happening is second time when it is called , the changes to the <code>$ul</code> variable  also is getting reflected on  <code>this.original_ul</code> . How can I possibly prevent this ?</p>

<pre><code>doLayout : function () {
    alert('doLayout');
    var size, $ul, $lis, loop, i;
    size = this.computeElesPerCol();
    $ul = this.original_ul; // I wanna  preserve this between calls
    $lis = $ul.children().filter(':gt(' + (size - 1) + ')');
    loop = Math.ceil($lis.length / size);
    i = 0;

    $ul.css('float', 'left').wrap("&lt;div style='overflow: hidden'&gt;&lt;/div&gt;");

    for (; i &lt; loop; i = i + 1) {
      $ul = $("&lt;ul /&gt;").css('float', 'left').append($lis.slice(i * size, (i * size) + 4)).insertAfter($ul);
      $ul.css("list-style","none");
    }
  }
</code></pre>

<p><strong>Edit:</strong> : <code>this</code> is a reference to the javascript object WebFloatLayout which basically does a multi column layout depending on the available height every time the browser is resized . The initial input is a long list of <code>&lt;lis&gt;</code> in a single <code>&lt;ul&gt;</code> . Here is how it gets initialized :</p>

<pre><code>     initialize:function () {
    var webFloatLayout = this;
    //call super parent initialize which will set the main dom element of component
    ec.comp.Component.prototype.initialize.call(this);
    var innerDivId = this.id + "_inner";
    innerDivId = innerDivId.replace(new RegExp(ec.config.separator, "g"), "\\" + ec.config.separator);
    $(document).ready(function() {
      webFloatLayout.original_ul = $("#" + innerDivId).find("&gt;:first-child");
      webFloatLayout.original_ul.css("list-style","none");
      webFloatLayout.layout();
    });
  },
</code></pre>
