$(document).ready(function() {
    decorateToggleDetailsVisibility();
});

/**
 * Decorates the TestNG-XSLT javascript function toggleDetailsVisibility() to
 * add some behaviors.
 */
function decorateToggleDetailsVisibility() {
    var original = toggleDetailsVisibility;
    
    window.toggleDetailsVisibility = function(elementId) {
        if (/_details$/.test(elementId)) {
            var exceptionId = elementId.replace(/details$/, 'exception');
            
            // hide all others
            $('.testMethodDetailsVisible').each(function() {
                if (this.id != elementId && this.id != exceptionId) {
                    this.className = 'testMethodDetails';
                }
            });
            
            // set frame
            top.frames['details'].location = fileNameMap[elementId];
        }
        
        original(elementId);
    }
}

