Please reason step by step, and put your final answer within \boxed{}.
Given that $i$ is the imaginary unit, find the values of the real number $a$ such that the magnitude of the complex number $\frac{1+ai}{2i}$ is $\frac{\sqrt{5}}{2}$.
user