sidarvik,
Вариант замены
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(function(){
$('img.highslide').each(function(){
var bigImgLink = $(this).attr("onclick").replace(/[\s\S]+src:.(.*?jpg)[\s\S]+/,'$1')
var a = $("<a/>").attr({'rel':'group1' , 'class' : 'fancybox' , 'href' : bigImgLink})
$(this).removeAttr("onclick").removeClass().wrap(a)
});
alert($('body').html());
});
</script>
</head>
<body>
<p class="fotoline"><img class="highslide" onclick="try{hs.expand(this,{src:'/d/163953/d/hurgada-.jpg'});}catch(e){}" src="/d/163953/d/180489406_5.jpg" width="180" height="120" alt="Хургада " border="0" /><img class="highslide" onclick="try{hs.expand(this,{src:'/d/163953/d/3170138978_07448bfbdf_o.jpg'});}catch(e){}" src="/d/163953/d/180488006_5.jpg" width="180" height="135" alt="3170138978_07448bfbdf_o" border="0" /><img class="highslide" onclick="try{hs.expand(this,{src:'/d/163953/d/egipet_1600.jpg'});}catch(e){}" src="/d/163953/d/109448406_5.jpg" width="180" height="135" alt="egipet_1600" border="0" /><img class="highslide" onclick="try{hs.expand(this,{src:'/d/163953/d/180489006_7.jpg'});}catch(e){}" src="/d/163953/d/180489006_5.jpg" width="180" height="135" alt="4064" border="0" /><img class="highslide" onclick="try{hs.expand(this,{src:'/d/163953/d/81.jpg'});}catch(e){}" src="/d/163953/d/109447006_5.jpg" width="180" height="135" alt="81" border="0" /></p>
</html>