﻿function shutdownPage() {
    //alert('Start of shutdownPage in installListeners.js');
    if (window.addEventListener) // W3C standard approach
    {
        window.detachEvent('load', initializePage, false); // Note that this event name is 'load' not 'onload'
    }
    else if (window.attachEvent) // Microsoft approach
    {
        window.detachEvent('onload', initializePage);
    }
    // alert('End of shutdownPage in installListeners.js');
    return true;
}


function installListeners() {
    //alert('Start of installListeners in installListeners.js');

    if (window.addEventListener) // W3C standard approach
    {       
        window.addEventListener('load', initializePage, false); // Note that this event name is 'load' not 'onload'
        window.addEventListener('unload', shutdownPage, false); // Note that this event name is 'unload' not 'onunload'
    }
    else if (window.attachEvent) // Microsoft approach
    {
        window.attachEvent('onload', initializePage);
        window.detachEvent('onunload', shutdownPage);       
    }
    //alert('End of installListeners in installListeners.js');
    return true;

}

//alert('inside listener.library.js');
