function categorySelector() {
    var width = $('#tools').width();
    var height = $('#tools').height();

    $('<div id="test-modal"></div>').insertAfter('#tools');
    $('#test-modal').css({'opacity': 0.5});
    $('#tools .description').hide();

    $('.description').bind('loadsifr', function(event) {
        if($(this).children('h2').hasClass('sIFR-replaced')) {
            $(this).unbind('loadsifr');
        }
        else {
            sIFR.replace(aachen, {
            	selector: '.description h2',
            	wmode: 'transparent',
            	fitExactly: true,
            	css: '.sIFR-root {color: #ffffff; font-size: 38px; leading: -5; letter-spacing: 1; text-transform: uppercase;}'
            });
        }
    });

    function activateTool() {
        var navlink = $(this).children("a").attr("rel");

        // add classes for over effect
        if (!($.browser.msie && $.browser.version.substr(0,1)<7)) {
            $('#category').addClass('modal-active');
            $(navlink).parent().addClass('over');
        }
        if($(this).hasClass('flip')) {
            $(this).children('a').children('img').css({
                'border-left': '2px dotted white',
                'border-right': 'none',
                'padding-left': '13px',
                'padding-right': '15px'
            });
        }else {
            $(this).children('a').children('img').css({
                'border-right': '2px dotted white',
                'padding-right': '13px'
            });
        }

        // animate tool
        $(this).css({"z-index": "10"});
        $(this).animate({"top": "-=5px"}, 100);
        $('#test-modal').stop(true, true).fadeIn(400);
        $(this).children('.description').fadeIn(100);

        // trigger custom sifr replacement event
        $(this).stop(true, true).children('.description').trigger("loadsifr");
    }
    function deactivateTool(){
        // stop the current animation
        $(this).stop(true, true);

        var navlink = $(this).children("a").attr("rel");

        // remove classes
        $(this).children('a').children('img').css({
            'border': 'none',
            'padding': '0 15px'
        });
        if (!($.browser.msie && $.browser.version.substr(0,1)<7)) {
            $('#category').removeClass("modal-active");
            $(navlink).parent().removeClass('over');
        }

        // animate tool
        $(this).children('.description').fadeOut(100);
        $('#test-modal').stop(true, true).fadeOut(100);
        $(this).css({"z-index": "0"});
        $(this).stop(true, true).animate({"top": "+=5px"}, 100);
    }

    $('#category-nav a').hover(
        function() {
            // find the associated tool
            var toolname = $(this).attr('class');
            var tool_link = $('#category a').filter(function() {
                return $(this).attr('rel') === ('.' + toolname);
            });
            var tool = tool_link.parent();

            $(this).stop(true, true);
            $(tool).stop(true, true).trigger('mouseenter');
        },
        function() {
            // find the associated tool
            var toolname = $(this).attr('class');
            var tool_link = $('#category a').filter(function() {
                return $(this).attr('rel') === ('.' + toolname);
            });
            var tool = tool_link.parent();

            $(this).stop(true, true);
            $(tool).stop(true, true).trigger('mouseleave');
        }
    );

//    $('#category-nav a').hover(
//        function() {
//            var className = $(this).attr('class');
//            var link = $('#category a').filter(function() {
//                var result = $(this).attr('rel') === ("." + className);
//                return result;
//            })
//            var relative = link.parent();

//            // add classes and CSS
//            if (!($.browser.msie && $.browser.version.substr(0,1)<7)) {
//                $('#category').addClass('modal-active');
//                $(this).parents('li').addClass('over');
//            }
//            if($(this).hasClass('flip')) {
//                $(relative).children('a').children('img').css({
//                    'border-left': '2px dotted white',
//                    'border-right': 'none',
//                    'padding-left': '13px',
//                    'padding-right': '15px'
//                });
//            }else {
//                $(relative).children('a').children('img').css({
//                    'border-right': '2px dotted white',
//                    'padding-right': '13px'
//                });
//            }

//            // animate tool
//            $(relative).css({"z-index": "10"});
//            $(relative).animate({"top": "-=5px"}, 100);
//            $('#test-modal').fadeIn(400);
//            $(relative).children('.description').fadeIn(100);

//            // trigger custom sifr replacement event
//            $(relative).children('.description').trigger("loadsifr");
//        },
//        function() {
//            var className = $(this).attr('class');
//            var link = $('#category a').filter(function() {
//                var result = $(this).attr('rel') === ("." + className);
//                return result;
//            })
//            var relative = link.parent();

//            $(relative).children('a').children('img').css({
//                'border': 'none',
//                'padding': '0 15px'
//            });
//            if (!($.browser.msie && $.browser.version.substr(0,1)<7)) {
//                $(this).parents('li').removeClass('over');
//                $('#category').removeClass('modal-active');
//            }

//            // animate tool
//            $(relative).children('.description').fadeOut(100);
//            $('#test-modal').fadeOut(100);
//            $(relative).css({"z-index": "0"});
//            $(relative).animate({"top": "+=5px"}, 100);
//        }
//    );

    $('#tools .tool').hover(activateTool, deactivateTool);

    // avoid leaving page in hover state in FF
    $('#tools .tool').click(function(){
        $(this).trigger('mouseleave');
    });
}

