You would have got better answers if you posted all your code in the first place. Don't just excerpt it.