(function($) {
$(document).ready(function() {

var colbas = 0;
var vivod = "";
var empty = new Array();
var emptytx = new Array();
$(".berjquery").load("http://antiquaire.ru/book4u0.html .dop_uslug_ramka", function(){
	$(".berjquery a.gallery").each(function(){
		if ($(this).has("img").html() != null){
			empty[colbas] = '<a class="gallery" target="_blank" title="books" rel="naglavnoy" href="'+$(this).attr("href")+'">'+$(this).has("img").html()+'</a>';
			colbas = colbas + 1;
		}
	});

	colbas = 0;

	$(".berjquery .single td p:first-child strong").each(function(){
		emptytx[colbas] = $(this).html();
		colbas = colbas + 1;
	});

	if (colbas > 4) colbas = 4;

	for (I=0; I<colbas; I++){
		vivod = vivod + "<div class='blocknaglav'>" + empty[I] + "<p>" + emptytx[I] + "</p></div>";
	}

	$(this).html(vivod);

	$("a.gallery, a.iframe").fancybox();
});

});
})(jQuery);
