/**
 * SwapIt
 *
 * Swapit is a quick and easy plugin designed to make 
 * simple mouseover image swapping easy.
 *
 * @example     $('.classname').swapit('_over');
 */
$.fn.swapit = function(a) {
    return this.each(function() {
        if($(this).get(0).tagName.toUpperCase() == 'IMG') {
            var original = $(this).attr("src");
            if(original.indexOf('_over') == -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); });
            }
        }
    });
}