What is the correct way to check for attachEvent() availability?
<p>I have seen these 3:</p>

<pre><code>if(window.attacheEvent)

if(document.attachEvent)

if(element.attachEvent)
</code></pre>

<p><strong>Note:</strong></p>

<ul>
<li><p>element is readily available.</p></li>
<li><p>no libraries please</p></li>
</ul>

<p><strong>Applied with the Facade Pattern</strong></p>

<p><strong>Per Answer - Barney</strong></p>

<pre><code>$NS.addEventL = (function determineEventBinding(){
    if(window.attachEvent){
        return function attachEvent(element, type, callNow){
            element.attachEvent('on' + type, callNow);
        }
    }
    else {
        return function addEventListener(element, type, callNow){
            element.addEventListener(type, callNow);
        }
    }
}());
</code></pre>

<p><strong>Previous Version</strong></p>

<pre><code>NS.addEventT = function (element, type, callNow) {
    if (element.addEventListener) {
        element.addEventListener(type, callNow);
        return;
    }
    if (element.attachEvent) {
        element.attachEvent('on' + type, callNow);
        return;
    }
};
</code></pre>
