Please stop posting such large swaths of code on the forum. This is exactly what Pastey is for (see the link under Misc Menu to the right).
-Greg