title: How to automatically close a popup in JQuery when another popup is opened?
body: <p>I have 3 Jquery Pop-Up windows in a page. When I open one window say login popup, and then I open another say feedback popup, I need to get my login popup closed when I click on feedback popup link.
  Here is the sample code for my login popup. I used the same for feedback popup too. Please help me with my query.
  Thank you all in advance.</p>
  
  <pre><code>$(document).ready(function() {
      $('a.login-window').click(function() {
  
        //Getting the variable's value from a link 
          var loginBox = $(this).attr('href');
  
          //Fade in the Popup
          $(loginBox).fadeIn(300);
  
          //Set the center alignment padding + border see css style
          var popMargTop = ($(loginBox).height() + 24) / 2; 
          var popMargLeft = ($(loginBox).width() + 24) / 2; 
  
          $(loginBox).css({ 
              'margin-top' : -popMargTop,
              'margin-left' : -popMargLeft
          });
  
          // Add the mask to body
          $('body').append('&lt;div id="mask"&gt;&lt;/div&gt;');
          $('#mask').fadeIn(300);
  
          return false;
      });
  
      // When clicking on the button close or the mask layer the popup closed
      $('a.close, #mask').live('click', function() { 
        $('#mask , .login-popup').fadeOut(300 , function() {
          $('#mask').remove();  
      }); 
      return false;
      });
  </code></pre>