So, where does the script you posted have problems? What have you tried to address these problems?
In reply to Re: Redoing a script by Corion in thread Redoing a script by PhiThors