Once the message has been decoded as Craig McQueen stated in a this thread post and you have your actual character count, to count the needed SMS amount the following is enough:
function cntsms(len){ return len<=0? 0: (len>160? Math.ceil(len/153): 1); }