$.fn.swapme = function(a){
    return this.each(function(){
        // bind the mouse events
        if($(this).get(0).tagName.toUpperCase() == "IMG"){
            var original = $(this).attr("src");
            if(original.indexOf("-hover") == -1){
                // get the new src string
                var over = original.split(".");
                if(over.length >= 2){
                    // add before the extension if we have one
                    over[over.length-2] += a;
                    over = over.join(".");
                } else {
                    over = original + a;
                }

                $(this).mouseover(function(){
                    $(this).attr("src", over);
                }).mouseout(function(){
                        $(this).attr("src", original);
                    });
            }
        } else {
            var original = $(this).css("background-image");
            if(original.indexOf("-hover") == -1){
                // get the new src string
                var over = original.split(".");
                if(over.length >= 2){
                    // add before the extension if we have one
                    over[over.length-2] += a;
                    over = over.join(".");
                } else {
                    over = original + a;
                }

                $(this).mouseover(function(){
                    $(this).css({"background-image": over});
                }).mouseout(function(){
                    $(this).css({"background-image": original});
                    });
            }
        }
    });
}