close popup and open new popup
<p>I am using model popup. when i click on close, i want to close the current popup n want open a new popup.. is it possible? i am using below javascript.. </p>

<p>Please help me..</p>

<pre><code>$(document).ready(function() {  

    //select all the a tag with name equal to modal
    $('a[name=modal]').click(function(e) {
        //Cancel the link behavior
        e.preventDefault();

        //Get the A tag
        var id = $(this).attr('href');

        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set heigth and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});

        //transition effect     
        $('#mask').fadeIn(1000);    
        $('#mask').fadeTo("slow");  

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        $(id).css('top',  winH/8-$(id).height()/8);
        $(id).css('left', winW/2-$(id).width()/2);

        //transition effect
        $(id).fadeIn(2000);

    });  

    //if close button is clicked
    $('.window .close').click(function (e) {
        //Cancel the link behavior
        e.preventDefault();

        $('#mask').fadeOut(1000);
        $('.window').fadeOut();
    }); 


    //if mask is clicked
    //$('#mask').click(function () {
        //$(this).fadeOut(1000);
        //$('.window').fadeOut();
     // });         

    $(window).resize(function () {

        var box = $('#boxes .window');

        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set height and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});

        //Get the window height and width
      var winH = $(window).height();
          var winW = $(window).width();

        //Set the popup window to center
        box.css('top',  winH/8 - box.height()/8);
        box.css('left', winW/2 - box.width()/2);

    });

});
</code></pre>
