function cmfCompareAdd(id) {


//var vtr = "compare" + id;
//var qty = document.getElementById(vtr).innerHTML;
//if(document.getElementById(vtr).innerHTML=='сравнить') { document.getElementById(vtr).innerHTML='в сравнении'; } else { document.getElementById(vtr).innerHTML='сравнить'; }

	cmfAjaxSend('/mainAjax/compare/add.php', {id: id});
}

function cmfCompareInit() {
	var json = cmfGetCookie('mainCompare_product');
	json = eval('(' + json + ')');
	$('a', $('#catalog')).each(
		function() {
			if(this.id) {
				if(this.id.indexOf('compare_')!=-1) {
					$(this).html('сравнить');
					if(json && json[this.name]) {
						$(this).html('в&nbsp;сравнении');
					}
				}
			}
		}
	);
}


function compareDeleteAll(type) {
	cmfAjaxSend('/mainAjax/compare/del.php', {action: 'all', type: type});
}


function compareClose() {
    if(window.opener)
		window.opener.document.location = window.opener.document.location;
	window.close();
}


function cmfCompareOpen(url) {
	window.open(url, 'compare', 'width='+screen.width+', height='+screen.height+', toolbar=0, statusbar=0, location=0, scrollbars=no, resizable=0');
}

function cmfCompareOpenPage(url) {
	if(window.opener) {
		window.opener.document.location = url;
		window.close();
	} else {
		document.location = url;
	}
}
