Delirium is a common complication in elderly patients following surgery. Patients who develop delirium after surgery are at increased risk for serious complications, and even death.This multi-centre randomized controlled trial will enroll elderly patients scheduled for elective hip/knee replacement surgery.The objective of this trial is to identify obstructive sleep apnea using ApneaLink Air and to determine whether auto-titrating CPAP treatment of obstructive sleep apnea will decrease the incidence of post-operative delirium in elderly patients undergoing elective hip and knee replacement surgery.