$.postJSON = function(url, data, callback) {
	$.post(url, data, callback, "json");
};


jQuery(document).ready(function() {
	$( "a.addtocompare" ).click( function () { 
		jQuery.getJSON("/quickshop/additemjson/"+$(this).attr('rel')+"/1" ,{ }, function(data){	
			$("#catalog-count").html(data.result);			 
		});
		return false;
	});
	
	$( "a.removefromcompare" ).click( function () { 
		jQuery.getJSON("/quickshop/deleteitem/"+$(this).attr('rel'),{ }, function(data){					
			$("#catalog-count").html(data.result);
		});
			
		$('#linebasket-'+$(this).attr('rel')).fadeOut('slow',function(){
		    
        		/*if ( ($("#page").height()+$("#footer-inside").height()) < ($(window).scrollTop()+$(window).height()))  
                {          
                    $("#footer-inside").css({"margin-top":($(window).scrollTop()+$(window).height()-$("#page").height()-$("#footer-inside").height()-10)+"px"});
                    $("#page-max-height").css({height:($(window).scrollTop()+$(window).height()-10)+"px"});
                }
                else
                    $("#page-max-height").css({height:"auto"});*/
		    
		});

		return false;
	});
	
	$( "a.updatecompare" ).click( function () { 
		jQuery.getJSON("/quickshop/updateitem/"+$(this).attr('rel')+"/"+$( "#catalog_item_count_"+$(this).attr('rel') ).val(),{ }, function(data){					
						$("#catalog-count").html(data.result);						
					});	
		return false;
	});

	jQuery.getJSON("/quickshop/compareupdate/",{ }, function(data){			
			$("#catalog-count").html(data.result); 
			
	});

	$('input.remarks-input').change(function(){	   
	    var data = {note: $(this).val()} 
	    jQuery.postJSON("/quickshop/changenote/"+$(this).attr('id'),data, function(data){			
						
	    });     
	});
	
	$('.catalog-line-zoom').mouseover(function(el) {
		
		var img = $(this).find(".hidden");
		$('.hidden').hide();	
		
		if (img.css('display') == "none"){			
			img.css('display', 'block');
		}	
	});
	
	$('.hidden').mouseout( function() {
					$(this).hide();	
				});
				
});

function clearBasket()
{
    jQuery.getJSON("/quickshop/clearbasket/",{ }, function(data){	
                        				
						$("#list-products").remove();
						$("#icons-block-id").remove();
						$("#hide-no-products").show();       			     
        			
        });					
				
}
