var ajaxlinks = function(context) {
    if (context == undefined) context = document;

    $(document).bind('changeDom', function(e, data) {
        ajaxlinks(data.where);
        });

    $('a.ajax', context).click(function() {
        var href = $(this).attr('href');

        if(href.match('^'+location.pathname))
            location.hash = href.replace(location.pathname, '');
        else
            location.hash = '!' + href;

        return false;
        });
};

$(document).ready(function() {
    ajaxlinks();
    });

