If you cant use box-sizing, doResize function without CSS

If you cant use box-sizing here is a full function without CSS.