I have spent most of today trying to work out why this bloody script didn't work as expected when using javascript. I don't know why all of a sudden it just miracuosly decided to work. I was so angry that I actually got a rolled up newspaper and hit the computer repeatedly.....Silly bastard I am.