Relative URL with Javascript
<p>I have a menu and each menu item has a picture.
This is a piece of code from one item:</p>

<pre><code>&lt;script type="text/javascript"&gt;        
    &lt;!--
    function changeImage(element, hoverImage) {
        document.getElementById(element).src = hoverImage;
    }
    // --&gt;
&lt;/script&gt;
&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="Menu.ascx.cs" Inherits="UserControls_Menu" %&gt;
&lt;ul id="navmenu"&gt;
    &lt;li&gt;&lt;a id="default" runat="server" href="~/Default.aspx" 
        onmouseover="changeImage('sideBar_Menu1_Image7', 'Images/Calendar32x32.png');"
        onmouseout="changeImage('sideBar_Menu1_Image7', 'Images/Calendar24x24.png');"&gt;
        &lt;table cellpadding="0" cellspacing="0" width="100%"&gt;
            &lt;tr&gt;
                &lt;td style="height: 32px; width: 32px"&gt;
                    &lt;asp:Image ID="Image7" runat="server" ImageUrl="~/Images/Calendar24x24.png" /&gt;
                &lt;/td&gt;
                &lt;td style="vertical-align: middle"&gt;
                    &lt;asp:Label ID="Label6" runat="server" Text="CALENDAR" meta:resourcekey="Label6Resource1"&gt;&lt;/asp:Label&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>When I run my app, when I am in the root folder the images on the menu will load, but when I am somewhere else, they will not load anymore. Is there a way it can be done from js? I wouldn't really want now to start making so many css classes to solve the issue.</p>

<p>LATER EDIT:
the solution consists of a BL project, a Jobs project and the website that's named CRM...when ran on the local machine, it works fine if I write /CRM/Images/Image.png, but when published it deos not work...if I write /Images/Image.png it doesn't work on the localhost but it works when published...I will not know the paths as it will be deployed to more clients, each of them will have a different path...but I have found a solution and lower is the code</p>

<p>Thanks</p>
