Surface states and oxygen chemisorption on Ti(0001)