Javascript + Differentiate user clicks and clicks sent from function
<p>I have an Accordion function like this:</p>

<pre><code>$("#notaccordion").addClass("ui-accordion ui-widget ui-helper-reset")
   .find("h3")
   .addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom")
    .prepend('&lt;span class="ui-icon ui-icon-triangle-1-e"/&gt;')
    .click(function () {
       $(this).toggleClass("ui-accordion-header-active").toggleClass("ui-state-active")
          .toggleClass("ui-state-default").toggleClass("ui-corner-bottom")
          .find("&gt; .ui-icon").toggleClass("ui-icon-triangle-1-e").toggleClass("ui-icon-triangle-1-s");
       if ($(this).next().is(':hidden') == true) {
          ;
          $(this).addClass('active'); $(this).next().slideDown('normal');
       }
       else {
          $(this).removeClass('active'); $(this).next().slideUp('normal');
       }

       //.end().next().slideUp('normal');
       return false;
    })
    .next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide();
</code></pre>

<p>and a click all panels function to expand all panels at once:</p>

<pre><code>function clickAllPanels() {
   var elm = document.getElementsByTagName('table');
   var i = elm.length; while (i--) {
      clickItem(elm[i]);
    }
}

function clickItem(divObj) {
   if (divObj.click) {
      divObj.click();
   } else if (document.createEvent) {
      var evt = document.createEvent("MouseEvents");
      evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
      var allowDefault = divObj.dispatchEvent(evt);
   }
}
</code></pre>

<p>How can I let the accordion <code>.click(function ()</code> function know that it's <code>clickAllPanels</code> that is sending the 'clicks' instead of a user's physical click. I need to do this because I want to change the slide up and down logic if it's from <code>clickAllPanels</code>.</p>
