Multifrequency variability of the blazar AO 0235+164. The WEBT campaign in 2004-2005 and long-term SED analysis