Essentially I am tring to write this:
var async1 = $.when( a1() ).then(function(){ a2() });
var async2 = $.when( a3() ).then(function(){ a4() });
$.when(async1, async2).then(function(){
console.log("complete");
});
But at the moment when a1 and a3 have executed the function considers itself resolved.
I put together the same example in a fiddle: http://jsfiddle.net/Z7fzR/