What happens when the function f(x)=cos(x) is transformed by the rule g(x)=f(1/2x)?

A: f(x) is stretched away from the y-axis by a factor of 2.
B: f(x) is compressed toward the y-axis by a factor of 1/2.
C: f(x) is compressed toward the x-axis by a factor of 1/2.