Please write comments in your code to make clear what you are expecting to happen. Also use tools such as pastebin if the forum does not colour-code. (how else should we know which line is 27?)
-> help those who help you.
It's fun to help others but work (pay me) to decypher and write another mans code.