It would be helpful - for both you and us - if your code had comments so that we all knew what you thought you were trying to do.

Since I'm not sure what you're thinking and how you've tried to...