resolves #2 rewrite alerts as a jquery plugin