﻿
function togglePL(targetEl, toggleDirectionEl, minHeight, elToggle, elTitle) {
    ///<summary>
    /// Expand\Collapse the results panel from a min height to no height restriction at all
    ///</summary>
    ///<param name="targetEl">The unique ID of the container element to be toggled</param>
    ///<param name="toggleDirectionEl">The unique ID of the toggle direction element</param>
    ///<param name="minHeight">Collapse height</param>
    
    // toggle direction element innerHTML - images may be used
    var toggleUpImg = "Plots [click for more]";
    var toggleDownImg = "Plots [click to contract]";
    
    // find the elements in the document
    var targetElement = document.getElementById(targetEl);
    var toggleDirectionElement = document.getElementById(elToggle);
    var toggleTitleElement = document.getElementById(elTitle);
    
    // toggle the height of the container element based on it's current height
    // and set the toggle direction element
    if(targetElement.style.height == '') {
    
        targetElement.style.height = minHeight;
        
        toggleTitleElement.innerHTML = toggleUpImg;
        
        toggleDirectionElement.innerHTML = '+';
        
    } else {
    
        targetElement.style.height = '';
        
        toggleTitleElement.innerHTML = toggleDownImg;
        
        toggleDirectionElement.innerHTML = '-';
        
    }
}