Still trying to learn the basic of jquery so in the weekend I started looking on simple rewriting of links in greasemonkey. The script is working but it's not looping. It just take the url from the first .img and and write it into all the other .img instead of getting the each link and write it into the same element. Not sure if it made any sense but take a look at the script and I'm sure you understand. :)
function rewrite() {
$.each($(".img"),function(){
var a=$("a img[src*='/SAN/']").attr('src');
$("a img[src*='/SAN/']").parent().attr('href','http://somesite.com/'+a);
});
}