Dirty as hell - I soon need to learn proper javascript!!