This is the first thing you need to understand. A lot of countries have much stricter laws. In Islamic countries, you cannot display affection publically, and you better not be caught displaying any type of religion that isn't Islam. In countries funny about their national security, you need to stick to only populated areas with a lot of tourist traffic. Understand that not every country is a free country.
Remember Michael Fay? He's the young man who was caught vandalizing in Singapore. As punishment, even after America pleaded for his acquittal, Fay was caned repeatedly. Hikers in Iran are held for months, if not years, on suspicion of spying. Some in North Korea and China said to be breaking the law are "kept" and never to be heard from again! Some countries are incredibly harsh with their punishments.
As we discussed above with Mr. Fay, sometimes your home country cannot do a single thing to help you. Those hikers in Iran were kept until former President Clinton intervened. Countries with close ties to one another can work things out. Most countries, however, don't like the US and thus, there's not much the US can do for diplomacy to save your butt! This goes for a lot of countries.
There's no better place to get access to the laws of other countries than from the other countries themselves. This means that you should be checking online before you visit any country. Check the country's own literature on the subject and have it translated. If that's not enough to give you a clear picture, stop by a designated office upon arrival and receive some of the rules and regulations so that you don't mistakenly step in it.
Keep your mouth shut at first and let the other country flex its muscle. More often than not, especially if you're American, other countries just want to make it a point to intimidate you. Unless you're dealing with a country like China, North Korea, Iran, Singapore, or a few other really hostile countries, you should be fine after the initial chewing out -- after which, it's imperative that you first contact your embassy and then your family at home. You need to sit back and keep your mouth shut while someone on the outside attempts to help you.
There are many, many friendly places in the world to travel to. Unfortunately, however, a lot of people decide that there's more reward than risk in dangerous territories, and they ultimately end up paying the price when visiting another country. Be a safe traveler and be aware of another country's laws. web directories