you can use my attached sample which I enclosed here .just search all of my forums.I cann't recollect what its name is. just view it. if you can not visible it. and add some function to achieve what you want.
________________________________________________________
Try to make everything Automatic