Greetings again!
Declare a variable like
var number_of_enemies = 0;
Now, in each "enemy"-action before doing a loop or anything just raise the variable by one.
number_of_enemies += 1;
This way, the enemies in the map are "counted" while their actions are initialized.
Again, you have to insert something in the "Death"-function:
number_of_enemies -= 1;
So, each time a bad guy dies, the number decreases by one.
All you need now is a global loop.
while (1)
{
if (number_of_enemies == 0) { next_level(); }
}
I hope this helps. 
Gnometech
P.S.: I am not too sure about it, but those questions seemed to me more like some for the Beginner's Forum... no offense meant...