Simple javascript image filter function.