Contact and near-contact binary systems - I. FT Lupi.