
function wishlist(id){
    $(document).ready(function(){
        $("#wishlist_"+id).toggle();
    });
}

function wishlist_add(id) {
		$.ajax({
			type: 'post',
			url: 'index.php?route=product/category/callback',
			dataType: 'html',
                        data: $('#wishlist_'+id+' :input'),
			success: function (html) {
				$("#wishlist_"+id+" .out").html(html);
			}
		});
}

function compares (cat) {
    var url ='/index.php?route=product/category/compares&cat='+cat;
    window.open(url,'','scrollbars=yes, resizable=yes');
}

function compare (id, cat) {


        $.get("/index.php?route=product/category/compare", { gid: id, gcat: cat }, function(data){
            if (data <= 4) {
                //if ($("input:checkbox").is(':checked')) {
                       $("input:checkbox").attr('disabled', false);
                   //}
                if (data >= 2) {
                    $.cookie("cat_<?=$category_id?>", "cat_<?=$category_id?>", {
                         path: "/"
                    });
                    $('#compare').attr('disabled','');
                    $('#compare').attr('disabled',false);
                } else {
                    $.cookie("cat_<?=$category_id?>");
                    $('#compare').attr('disabled','disabled');
                }

                $.cookie("num_<?=$category_id?>", data, {
                     path: "/"
                });

                //alert($.cookie("num_<?=$category_id?>"));
            } else {
                alert('Возможно сравнение только 4 моделей');
                   if ($("input:checkbox").not(':checked')) {
                       $("input:checkbox").not(':checked').attr('disabled', true);
                   }

            }
        });

}
