[jQuery] Wait for one function to finish, then start the next....

[jQuery] Wait for one function to finish, then start the next....


I have seen a few of threads on this issue. However, they have mostly
deal with the fadeins or fadeouts which is not what I am needing. Here
is what I need:
On a click event, start function 1. Then after it's finished, start
function2. Here is my code:
var $j = jQuery.noConflict();
        $j(document).ready(function(){
            $j("#select_inv").click(function() {
                open_popup("Inv_Inventory", 600, 400, "", true, false,
{"call_back_function":"set_return","form_name":"EditView","field_to_name_array":
{"id":"inv_inventory_id_c","name":"name_c","make_c":"make_c","model_c":"model_c","year_c":"yearmanufactured_c","bodystyle_c":"bodystyle_c","vin_c":"vin_c","miles_c":"odometer_c","exteriorcolor_c":"exteriorcolor_c","interiorcolor_c":"interiorcolor_c","trim_c":"trim_c","stocktype_c":"conditionstocktype_c"}},
"single", true);
                    function2();
                });
            });
        });
Right now, it runs the open_popup function fine. However, it runs
function2() immediately. I need it to wait until the open_popup
function is finished, and then run the function2() script.
Any help would be greatly appreciated! Thanks!