I think that the only logical course of action–if you plan to keep the car–is to have your mechanic find a replacement engine from a collision-damaged car at junkyard. A 12 year old car is simply not worth the investment necessary to install a new/rebuilt engine.
The cost will vary a lot, depending upon where you live, and on the prevailing labor rates in your region, but I think that a reasonable cost estimate would be somewhere in the neighborhood of $1,700 for the engine + the labor of removing the old engine and installing the new one.
While the car is in the shop, I suggest having the trans fluid and filter changed, as that can help to extend the life of your transmission. Otherwise, you could be looking at the cost of an overhauled transmission a few months after installing the replacement engine.