var container = document;
var images = container.getElementsByTagName("IMG");

$("img[src^='utils/']").each( function() { newsrc = "/" + $(this).attr("src"); $(this).attr("src", newsrc); } );
$("img[src^='../img/Image/']").each( function() { newsrc = $(this).attr("src").substr(2); $(this).attr("src", newsrc); } );
$("a[href^='../']").each( function() { newhref = $(this).attr("href").substr(2); $(this).attr("href", newhref); } );

for(var i=0;i<images.length;i++){
	var img = images[i];
	if(img.className == 'lightbox'){
		img.src = img.src.replace(/\.\.\.\./, "..");
		var rel = document.createElement("A");
		rel.className = 'lightbox';
		var href = '/utils/thumbnail.php?gd=2&maxw=800&maxh=800&src=../'+img.src.substr(img.src.indexOf("img/"));
		rel.setAttribute("href", href);
		rel.appendChild(img.cloneNode(false));
		
		img.parentNode.insertBefore(rel, img);
		img.parentNode.removeChild(img);
	}
	
}
