var imgArrow = <asp:Literal runat=”server” Text=”<%$SPUrl:~sitecollection/
Style Library/Custom/images/stockup.png%>” />;
While I had originally thought this was a kludgey solution to begin with, it was getting the job done every single time.
However, a problem arose a few days after when I began refactoring the code. I had moved all of the js code from the master page itself into a separate js file, leaving only a static reference to the script on the master. The following code should be put within the ScriptManager control.