$().ready (function () {
	$('.close-message').click (function () {
		$(".setmes").hide ();
	});
	$('.setmes').dblclick (function () {
		$(".setmes").hide ();
	});
	
	$('.plrc-block .plrc-block-body a.main-image').bind('mouseover', function() {
		$('.img-zoom-ico', $(this)).animate({opacity:0.8}, 'slow');
	}).bind('mouseout', function() {
		$('.img-zoom-ico', $(this)).animate({opacity:0}, 'slow');
	});
});

var page = 1;

// Read more
$().ready (function () {
	console.log (GEOURL + '/catalog/' + CATID + '/' + CATURL + '/load_more');
	$('#catalog-load-more-result').click (function () {
		catalog_load_more_result ();
		return ;
	});
	$('#catalog-load-more-result').dblclick (function () {
		catalog_load_more_result ();
		return ;
	});
	
	$('.plrc-block .plrc-block-body a.main-image').bind('mouseover', function() {
		$('.img-zoom-ico', $(this)).animate({opacity:0.8}, 'slow');
	}).bind('mouseout', function() {
		$('.img-zoom-ico', $(this)).animate({opacity:0}, 'slow');
	});
});

function catalog_load_more_result () {
	jQuery('#catalog-load-more-result .progress-loader').show();
	jQuery.ajax({
		url: GEOURL + '/catalog/' + CATID + '/' + CATURL + '/load_more?' + SESSION_NAME + '=' + SESSION_ID, 
		dataType: 'html',
		type: 'get',
		crossDomain: true,
		data: {
			rand: Math.random(),
		},
		error: function(){
			jQuery('#catalog-load-more-result .progress-loader').hide();
		},
		success: function(data){
			jQuery('#catalog-load-more-result .progress-loader').hide();
			if (data == 'NULL') {
				$("#catalog-load-more-result").remove ();
				$(".list-load-more").html ("Записей больше нет");
			}
			else {
				page = page + 1;
				jQuery('.list-items').append('<span id="list-items-page-' + page + '"></span>'); // т.к. не всегда срабатывает автоматическая загрузка данных
				jQuery('#list-items-page-' + page + '').append(data).hide();
				jQuery('#list-items-page-' + page + '').slideDown("slow");
			}
		}
	});
}

function printProduct (data) {
	
}
