/********************************************************* Set of JavaScript functions for use with currency formats *********************************************************** The code contained herein contstitutes Medical Office Online, Inc's copyright and is intended for use by its customers and potential customers only. User may not modify, remove, delete, augment, add to, publish, transmit, participate in the transfer or sale of, create derivative works from, or in any way exploit any of the code contained herein, in whole or in part. This Web site is offered to the user conditioned on acceptance by the user without modification of the terms, conditions, and notices contained herein. By accessing and using this Web site, the User is deemed to have agreed to all such terms, conditions, and notices. **********************************************************/ /************************************************************************************ currencyToNumber() recieves a currency (string) value and returns a number arguments: cStr = string - currncy string in the format $0.00 returns: number ************************************************************************************/ function currencyToNumber(cStr) { if(cStr == "") cStr = "$0.00"; var flt = parseFloat(cStr.replace(/\$/,"").replace(/\,/g,"")); return Math.round(flt*100)/100; } /************************************************************************************ numberStrToCurrency() recieves a number string and returns a currency value in the format $0.00 arguments: numStr = string - a number returns: string - in the format $0.00 ************************************************************************************/ function numberStrToCurrency(numStr) { numStr = "$" + numStr; if(numStr.indexOf(".") == -1) numStr = numStr + ".00"; //bk20110616 if (numStr.indexOf(".5") == numStr.length-2) numStr = numStr + "0"; return numStr; }