First of all, before I say anything else, I'd like to offer my condolences and best wishes to those who are killed, in the process of passing away from the affects the bomb had, and to those who lost loved one in the attack.
Now...the fun, educational part. Japan wasn't actually trying to surrender officially, get your facts straight. I watched a documentry about this a few days ago

. They were trying to make peace with Russia because the Russians were just clobbering them in their held territory near Russia, etc. These peace talks were kept quiet from the Americans for some reason, I forgot why. Also, the Japanese "Big 6" 3 civilians and 3 military leaders formed the Council, the ruling body of Japan. They were divided on whether to surrender or continue the fighting, of course the Military wanted to keep fighting.
Anyways, the Russians wanted the war to last as long as possible because that would drain the Americans etc, and allow them to participate in the rebuilding process of Japan, something the Americans didn't want them apart of (think Communism

). Well, Russia kept the Japanese busy, leading them on, and making it seem like they were interested in the surrender. Then they struck and Japan was overwhelmed, but not ready to surrender. Russia didn't know about the Atom Bomb therefore their efforts were in vain. Japanese people were proud of what their country was, and would not give up easily.
So, the US offered the option to surrended or face destruction like never before seen, the Japanese rejected it. The US dropped the two Nukes, with a third one prepared for Tokyo. Japan surrendered. After, the American Post War occupation actually brought prosperity to Japan making them 2nd to only the US.
This gives you an idea of what happened, I probably missed some things, sorry.
Now, you can't go pointing fingers and saying it was stupid. Back then, it was a smart decision, just like in WW1, they though running out of a trench and throwing yourself into machine gun fire was the greatest strategy ever

. I believe this was the better course of action. Who knows, Japan could have been communist or something else otherwise. Just be happy everything seems to have turned out alright for the country and do not dwell one what we could have done.....and don't you dare build a time machine and try to correct things ^_~.