Rewrote a good portion of this to try to create a more consistent method of calculation, also added support for thin|thick|medium border widths (direct replacement) and error handling. In testing, I hit it in IE7 native and in IE7 emulation and compatibility views in IE8/IE9/IE11.