Which country has jurisdiction over incidents in flight? If an incident occurs on board an aircraft in flight which could be considered as criminal in one country, what decides which country the incident falls under? For example, if a man was found to be in possession of "virtual" child pornography and not all of the countries involved consider that to be illegal, which country is the one who decides whether the person have broken the law or not?
In my PPL class I was taught a simplified explanation:

If a baby was born (or a crime committed for that matter) on an aircraft, the official country in which it was born depends on wether the aircraft's doors are open or closed (within reasonable limits, so assuming they can't be open in flight).

If the doors are open, the country will be the country where the aircraft is currently located. If the doors are closed, it will be the country in which the aircraft is registered.