JQuery and Changing images

Im looking at a pretty old table driven site for a client. Its an affiliate based site so affiliates of the company can use their booking engine. They want to be able for affiliates to change some of the hardcoded images so as to use their own coloured ones.

Is it possible with Jquery to change the image path on all of the images. So for example from:

/images/blah.gif

to

/images/affiliate/blah.gif

Unfortuntly due to the nature and size of the company I cant use htaccess or do any real code changes hence i thought a JQuery would do it

Any help or advice greatly appreciated

Try something like this:

$(document).ready(function() 
{
    $("img[src^='/images']").each(function()
    {
        $(this).attr('src', $(this).attr('src').replace("/images/", "/images/affiliate/"));
    });
});

I haven’t tested it, so it may not work.