Just as a side note. It would do you a wealth of good by looking into Regular Expressions. If I had used it, the above code wouldn't have looked so messy, and a bit more streamlined. I didn't use it here as I am pressed for time here at work