Framelets and Wavelets Derived from Refinable Functions