Coupling asynchronous scripts
<p>Please help me to solve the problem with detecting when the asynchronous script is loaded. Actually I have a live chat button on my website that loads asynchronously, the script of this widget is obuscated. I need to set an eventlistener on the chat button after this script loads. Window.onload triggers before chat button appears. Please advise.</p>

<p>Code:</p>

<pre><code>_shcp = [];
_shcp.push({
    widget_id: xxxxxx,
    widget: "Chat",
    side: "left",
    position: "center",
    template: "orange",
    title: "Live help",
    text_layout: "trans",
    track: 1
});
(function () {
    var hcc = document.createElement("script");
    hcc.type = "text/javascript";
    hcc.async = true;
    hcc.src = ("https:" == document.location.protocol ? "https" : "http") + "://widget.siteheart.com/apps/js/sh.js";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hcc, s.nextSibling);
})();
</code></pre>
