Subsurface oxygen and surface oxide formation at Ag(111): A density-functional theory investigation