﻿// JScript File

var lastSummaryId=null;

function showSummary(divID) { setTimeout("doShowSummary('"+divID+"')",100) }
function doShowSummary(divID) {    
    hideSummary();
    lastSummaryId = divID;
    setDisplayStyle(divID, 'block');
}

function hideSummary() {
   if (lastSummaryId != null) {
        setDisplayStyle(lastSummaryId, 'none');
    }
}

function setDisplayStyle(id, displayStyle) {
    document.getElementById(id).style.display=displayStyle;
}    

function hideOnBodyClick() {
    document.getElementById('Body').onclick=hideSummary;
}


//this function toggles the visibility of a passed details div.  It also changes the innterHTML of the link from Show to Hide.
function ToggleCalculatorDetails(targetID, senderID) {
    var targetSummary = document.getElementById("divSummary_" + targetID);
    var targetDetails = document.getElementById("divDetails_" + targetID);
    var sender = document.getElementById(senderID);
    
    if (targetDetails.style.display=='none') {
        targetSummary.style.display='none';
        targetDetails.style.display='block';
        sender.innerHTML = "HIDE all details";
    } else {
        targetSummary.style.display='block';
        targetDetails.style.display='none';
        sender.innerHTML="SHOW all details";
    }
}
