Cosmology with a variable Chaplygin gas