$.fn.swapit = function(a)
{
return this.each(function()
{
var i = (new Image).src = a;
var i2;
var c;
// bind the mouseover and mouseout event to swap the images
if($(this).get(0).tagName.toUpperCase() == "IMG")
{
i2 = $(this).attr("src");

$(this).mouseover(function(i2)
{
$(this).attr("src", i2);
}).click(function()
{
$(this).attr("src", a);
});
}else{
i2 = $(this).css("background-image");
$(this).mouseover(function()
{
c = "url(" + a + ")";
$(this).css({"background-image":c});
}).mouseout(function(){
$(this).css({"background-image":i2});
});
}
});
}