(function($){
    $.fn.swapImage = function(options) {
        checkProperty('imgId');
        checkProperty('firstImage');
        checkProperty('secondImage');
        this.mouseover(function() {
            $('#'+options.imgId).attr('src', options.secondImage);
        });
        this.mouseout(function(){
            $('#'+options.imgId).attr('src', options.firstImage);
        });
        function checkProperty(name) {
            if(typeof(options[name]) != 'string') {
                alert(name + ' is not defined')
            }
        }
    };
})(jQuery);


