Please read the posting guidelines.
One more time:- When posting here please help us to help you by making it easier to copy, test and debug your scripts by following the posting guidelines and wrapping your code in CODE tags. This means use the octothorpe or # button on the toolbar. You can (and should) edit your previous post.
And please note that double posting is not permitted. Nor is it considered a good idea to hi-jack someone else's ancient thread.
If you disregard the forum guidelines then it is likely that other people will disregard you.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.