I dont think Hamlet went crazy... i think he just got caught up in his own feelings. He was so focused on getting revenge that in his mind anything he did was justified by the fact that he was getting the people that did him wrong. Throughout the play he started changing into more of a heartless man because he started to realize how messed up everything was.
His family was totally broken up his father died, his mother married his uncle making him the king. If that wasn't enough he found out that his father was murdered by his uncle, information that was kept tenable by his mother.
"O, from this time forth my thoughts be bloody or be nothing worth!"
(4.5.68 hamlet)