One thing I still don't understand is how the kings intertwined and started naming their children after relatives, which is very confusing. Why would kings do that when the entire pride of a king rests on the fact of all they have accomplished in their reign and in the hope that their lineage will carry on, which are things that can get mixed up and given credit to the wrong king and family if they all have the same names?
Even today we have people who name children after fathers, grandfathers, or a favorite relative, so it isn't surprising to see people doing it in the past. After all, we've had two John Adams and two George Bushes as presidents in our country. We see it as confusing because we have decades of history condensed for us in a few sentences. Sometimes names just become popular and several people just happen to have the same name.
Jehoshaphat's eldest son, Jehoram, was born seven years before Jehosphaphat became king in Judah. Ahab who was reigning at the time in Israel named his eldest son Ahaziah and his second son Jehoram. Ahab's son Jehoram wasn't expected to take the throne in Israel. He only became king because his eldest brother only reigned two years before dying and he died without heirs. That is how there ended up being two Jehorams on two thrones at the same time.
Jehoram married Athaliah, Ahab's daughter, and their first son was named Ahaziah -- most likely named after Athaliah's brother. He was born about eight years before Azahiah took the throne in Israel. Jehoram's son, Ahaziah, did not come to the throne until 12 years after his uncle of the same name had died. For people at that time, there would not have been any confusion about the kings.
Jehu, who overthrew Jehoram in Israel, named his eldest son Jehoahaz (the other name of Ahaziah in Judah). We don't know how old Jehoahaz was when he became king of Israel. He could have been born before his father Jehu even knew that God had picked him to be the next king in Israel. But he started reigning 29 years after Jehoahaz (Ahaziah), king of Judah, had died. So again, people would not have mixed the two up.
Now Jehoahaz of Israel did name his eldest son Jehoash while Judah's current king was name Jehoash. That was bound to cause some confusion as they both ended up ruling at the same time.
That is why, when reading the accounts of the kings you need to pay attention to which country the king was reigning.