thanks mate I have been trying to work this thing out for ages. this is a life saver i will post how my project goes.