    $(function() {
        attachCategoryEvents();
    });
    
    $(document).ready(function() {
        $('#compareRow .wrap #number').css('display', 'block');
        $('#compareRow .wrap #text').css('display', 'block');

        var number = parseInt($('#number').html());
        $('.compareBox').each(function() {
            if($(this).attr('checked') == true) {
                //number = number + 1;
                //$('#number').html(number);
                $(this).parent().parent().children('.added').html('ADDED');
            }
        });
    });
    
    function removeEvents() {
        $('*').unbind();
    };
    
    function attachCategoryEvents() {
    
        $('#submitCompare').click(function() {
            
        });
        
        $('.compareBox').click(function() {
        
            var compareId = $(this).attr('value');
            var number = parseInt($('#number').html());
            if($(this).attr('checked') == true) {
                if(number >= 4) {
                    alert('Maximum number of items to compare is 4 - please deselect one');
                    return false;
                } else {
                    $('#number').html(number + 1);
                    $(this).parent().parent().children('.added').html('ADDED');
					$.ajax({
                            type:               "GET",
                            url:                  "/interface/ajax/modules/products/compare.php",
                            dataType:        "html",
                            cache:              false,
                            data:                "id="+compareId+"&method=add",
                            success:            function(html){
                                                    }
                    });
                }
            } else {
                $('#number').html(number - 1);
                $(this).parent().parent().children('.added').html('');
                $.ajax({
                            type:               "GET",
                            url:                  "/interface/ajax/modules/products/compare.php",
                            dataType:        "html",
                            cache:              false,
                            data:                "id="+compareId+"&method=remove",
                            success:            function(){
                                                    }
                    });
            }
            return true;
        
        });
        
        $('#linkClick').click(function() {
            $('#hiddenLink').show('normal');
            return false;
        });
        
        $('#hiddenLink').click(function() {
            this.select();
            return false;
        });
    
    }
