title: detect if modal is currently active
body: <p>how can i detect if a modalpopupextender is currently being shown using javascript?</p>
  
  <p><strong>Modalpopupextender markup</strong></p>
  
  <pre><code>  &lt;!-- Add Files Modal Form --&gt;
      &lt;asp:HiddenField ID="AddFilesForModal" runat="server" /&gt;
      &lt;ajaxToolkit:ModalPopupExtender runat="server" ID="AddFilesModal" BehaviorID="modalPopupExtenderAddFiles"
          TargetControlID="dummyButtonAddToPendingList" PopupDragHandleControlID="PanelAddFilesOuter" PopupControlID="PanelAddFilesOuter"
          OkControlID="dummyButtonAddToPendingList" BackgroundCssClass="modalBackground" DropShadow="false"
          Drag="true"&gt;
      &lt;/ajaxToolkit:ModalPopupExtender&gt;
      &lt;ajaxToolkit:RoundedCornersExtender ID="RoundedCornersExtender4" runat="server" TargetControlID="PanelAddFilesInner"&gt;
      &lt;/ajaxToolkit:RoundedCornersExtender&gt;
      &lt;asp:Panel ID="PanelAddFilesOuter" runat="server"   BackColor="Transparent" Style="display: none;"&gt;
          &lt;asp:Panel ID="PanelAddFilesInner" runat="server" BackColor="White" Style=" width:800px; height:600px;  overflow:auto;"&gt;
           &lt;ContentTemplate&gt;
              &lt;div id="AddFilesContainer" style="  padding-left:10px; padding-right:10px; padding-top:10px; padding-bottom:5px;"&gt;
                  &lt;br /&gt;
                  Add Files
                  &lt;div  id="AddFiles_Div" style="height:80%;overflow:auto;"&gt;
                              &lt;asp:TreeView ID="TreeViewAddItems" runat="server" Height="500px"  ShowCheckBoxes="Leaf"
                                  Width="380px" ImageSet="XPFileExplorer" NodeIndent="15" PathSeparator="\" ShowExpandCollapse="true"
                                  EnableClientScript="true" OnTreeNodeCheckChanged="OnTreeNodeCheckChanged" OnAdaptedTreeNodeCheckChanged="OnTreeNodeCheckChanged" ShowLines="True"&gt;
                                  &lt;HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" /&gt;
                                  &lt;NodeStyle Font-Names="Tahoma" Font-Size="10pt" ForeColor="Black" HorizontalPadding="2px"
                                      NodeSpacing="0px" VerticalPadding="2px" /&gt;
                                  &lt;ParentNodeStyle Font-Bold="False" /&gt;
                                  &lt;SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
                                      VerticalPadding="0px" /&gt;
                              &lt;/asp:TreeView&gt;
                              &lt;/div&gt;
                  &lt;br /&gt;
                  &lt;div class="base" style="height:20px;"&gt;
                  &lt;asp:LinkButton ID="lnkAddToPendingList" runat="server" OnClick="BtnAddToPendingList_Click" BorderStyle="Solid" BackColor="#CCCCCC"&gt;Add selected items to list&lt;/asp:LinkButton&gt;
                  &lt;asp:Button CssClass="Button" ID="dummyButtonAddToPendingList" runat="server" Style="display: none;" /&gt;
                  &lt;asp:Button CssClass="Button" ID="CancelAddFiles" runat="server" Text="Cancel" OnClientClick="$find('modalPopupExtenderAddFiles').hide(); return false;" /&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;/ContentTemplate&gt;
          &lt;/asp:Panel&gt;
      &lt;/asp:Panel&gt;
      &lt;!-- End Add Files Modal Form --&gt;
  </code></pre>