I am trying to close the overlay and mask after a function completes without using a click handler. For instance:


ajaxCall = function(){
  //make ajax call stuff
  closeOverlay();
}

I have created the closeOverlay() function like this:


closeOverlay = function(){
  $("a[rel]").each(function() {
    if ($(this).overlay()) {
       $(this).overlay().close();
    } 
  });
}

But when I call this function after the ajax completes I get very odd behavior. This is incorrect. Can anyone point me to where the online documentation is to solve this problem? Thank you!