/**
* autoNumeric.js
* @author: Bob Knothe
* @author: Sokolov Yura
* @version: 1.9.26 - 2014-10-07 GMT 2:00 PM
*
* Created by Robert J. Knothe on 2010-10-25. Please report any bugs to https://github.com/BobKnothe/autoNumeric
* Created by Sokolov Yura on 2010-11-07
*
* Copyright (c) 2011 Robert J. Knothe http://www.decorplanit.com/plugin/
*
* The MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
!function(c){"use strict";function r(e,t,a){if(void 0===e.selectionStart){e.focus();var n=e.createTextRange();n.collapse(!0),n.moveEnd("character",a),n.moveStart("character",t),n.select()}else e.selectionStart=t,e.selectionEnd=a}function v(e,t){"string"==typeof e[t]&&(e[t]*=1)}function a(e,t){var a,n;a=e,n=t,c.each(n,function(e,t){"function"==typeof t?n[e]=t(a,n,e):"function"==typeof a.autoNumeric[t]&&(n[e]=a.autoNumeric[t](a,n,e))}),t.oEvent=null,t.tagList=["b","caption","cite","code","dd","del","div","dfn","dt","em","h1","h2","h3","h4","h5","h6","ins","kdb","label","li","output","p","q","s","sample","span","strong","td","th","u","var"];var i=t.vMax.toString().split("."),r=t.vMin||0===t.vMin?t.vMin.toString().split("."):[];if(v(t,"vMax"),v(t,"vMin"),v(t,"mDec"),t.mDec="CHF"===t.mRound?"2":t.mDec,t.allowLeading=!0,t.aNeg=t.vMin<0?"-":"",i[0]=i[0].replace("-",""),r[0]=r[0].replace("-",""),t.mInt=Math.max(i[0].length,r[0].length,1),null===t.mDec){var o=0,s=0;i[1]&&(o=i[1].length),r[1]&&(s=r[1].length),t.mDec=Math.max(o,s)}null===t.altDec&&0<t.mDec&&("."===t.aDec&&","!==t.aSep?t.altDec=",":","===t.aDec&&"."!==t.aSep&&(t.altDec="."));var u=t.aNeg?"([-\\"+t.aNeg+"]?)":"(-?)";t.aNegRegAutoStrip=u,t.skipFirstAutoStrip=new RegExp(u+"[^-"+(t.aNeg?"\\"+t.aNeg:"")+"\\"+t.aDec+"\\d].*?(\\d|\\"+t.aDec+"\\d)"),t.skipLastAutoStrip=new RegExp("(\\d\\"+t.aDec+"?)[^\\"+t.aDec+"\\d]\\D*$");var l="-"+t.aNum+"\\"+t.aDec;return t.allowedAutoStrip=new RegExp("[^"+l+"]","gi"),t.numRegAutoStrip=new RegExp(u+"(?:\\"+t.aDec+"?(\\d+\\"+t.aDec+"\\d+)|(\\d*(?:\\"+t.aDec+"\\d*)?))"),t}function u(e,t,a){if(t.aSign)for(;-1<e.indexOf(t.aSign);)e=e.replace(t.aSign,"");e=(e=(e=e.replace(t.skipFirstAutoStrip,"$1$2")).replace(t.skipLastAutoStrip,"$1")).replace(t.allowedAutoStrip,""),t.altDec&&(e=e.replace(t.altDec,t.aDec));var n=e.match(t.numRegAutoStrip);if(e=n?[n[1],n[2],n[3]].join(""):"",("allow"===t.lZero||"keep"===t.lZero)&&"strip"!==a){var i=[],r="";-1!==(i=e.split(t.aDec))[0].indexOf("-")&&(r="-",i[0]=i[0].replace("-","")),i[0].length>t.mInt&&"0"===i[0].charAt(0)&&(i[0]=i[0].slice(1)),e=r+i.join(t.aDec)}if(a&&"deny"===t.lZero||a&&"allow"===t.lZero&&!1===t.allowLeading){var o="^"+t.aNegRegAutoStrip+"0*(\\d"+("leading"===a?")":"|$)");o=new RegExp(o),e=e.replace(o,"$1$2")}return e}function l(e,t,a){return t=t.split(","),"set"===a||"focusout"===a?(e=e.replace("-",""),e=t[0]+e+t[1]):"get"!==a&&"focusin"!==a&&"pageLoad"!==a||e.charAt(0)!==t[0]||(e=(e=e.replace(t[0],"-")).replace(t[1],"")),e}function o(e,t,a){if(t&&a){var n=e.split(t);n[1]&&n[1].length>a&&(e=0<a?(n[1]=n[1].substring(0,a),n.join(t)):n[0])}return e}function s(e,t,a){return t&&"."!==t&&(e=e.replace(t,".")),a&&"-"!==a&&(e=e.replace(a,"-")),e.match(/\d/)||(e+="0"),e}function h(e,t){if(e){var a=+e;if(a<1e-6&&-1<a)(e=+e)<1e-6&&0<e&&(e=(e=(e+10).toString()).substring(1)),e<0&&-1<e&&(e="-"+(e=(e-10).toString()).substring(2)),e=e.toString();else{var n=e.split(".");void 0!==n[1]&&(e=0==+n[1]?n[0]:(n[1]=n[1].replace(/0*$/,""),n.join(".")))}}return"keep"===t.lZero?e:e.replace(/^0*(\d)/,"$1")}function p(e,t,a){return a&&"-"!==a&&(e=e.replace("-",a)),t&&"."!==t&&(e=e.replace(".",t)),e}function g(e,t){var a=+(e=s(e=o(e=u(e,t),t.aDec,t.mDec),t.aDec,t.aNeg));return"set"===t.oEvent&&(a<t.vMin||a>t.vMax)&&c.error("The value ("+a+") from the 'set' method falls outside of the vMin / vMax range"),a>=t.vMin&&a<=t.vMax}function d(e,t,a){return""===e||e===t.aNeg?"zero"===t.wEmpty?e+"0":"sign"===t.wEmpty||a?e+t.aSign:e:null}function f(e,t){var a=(e=u(e,t)).replace(",","."),n=d(e,t,!0);if(null!==n)return n;var i="";i=2===t.dGroup?/(\d)((\d)(\d{2}?)+)$/:4===t.dGroup?/(\d)((\d{4}?)+)$/:/(\d)((\d{3}?)+)$/;var r=e.split(t.aDec);t.altDec&&1===r.length&&(r=e.split(t.altDec));var o=r[0];if(t.aSep)for(;i.test(o);)o=o.replace(i,"$1"+t.aSep+"$2");if(e=0!==t.mDec&&1<r.length?(r[1].length>t.mDec&&(r[1]=r[1].substring(0,t.mDec)),o+t.aDec+r[1]):o,t.aSign){var s=-1!==e.indexOf(t.aNeg);e=e.replace(t.aNeg,""),e="p"===t.pSign?t.aSign+e:e+t.aSign,s&&(e=t.aNeg+e)}return"set"===t.oEvent&&a<0&&null!==t.nBracket&&(e=l(e,t.nBracket,t.oEvent)),e}function m(e,t){e=""===e?"0":e.toString(),v(t,"mDec"),"CHF"===t.mRound&&(e=(Math.round(20*e)/20).toString());var a="",n=0,i="",r="boolean"==typeof t.aPad||null===t.aPad?t.aPad?t.mDec:0:+t.aPad,o=function(e){var t=0===r?/(\.(?:\d*[1-9])?)0*$/:1===r?/(\.\d(?:\d*[1-9])?)0*$/:new RegExp("(\\.\\d{"+r+"}(?:\\d*[1-9])?)0*$");return e=e.replace(t,"$1"),0===r&&(e=e.replace(/\.$/,"")),e};"-"===e.charAt(0)&&(i="-",e=e.replace("-","")),e.match(/^\d/)||(e="0"+e),"-"===i&&0==+e&&(i=""),(0<+e&&"keep"!==t.lZero||0<e.length&&"allow"===t.lZero)&&(e=e.replace(/^0*(\d)/,"$1"));var s=e.lastIndexOf("."),u=-1===s?e.length-1:s,l=e.length-1-u;if(l<=t.mDec){if(a=e,l<r){-1===s&&(a+=".");for(var c="000000";l<r;)a+=c=c.substring(0,r-l),l+=c.length}else r<l?a=o(a):0===l&&0===r&&(a=a.replace(/\.$/,""));if("CHF"!==t.mRound)return 0==+a?a:i+a;"CHF"===t.mRound&&(s=a.lastIndexOf("."),e=a)}var h=s+t.mDec,p=+e.charAt(h+1),g=e.substring(0,h+1).split(""),d="."===e.charAt(h)?e.charAt(h-1)%2:e.charAt(h)%2,f=!0;if(1!==d&&(d=0===d&&0<e.substring(h+2,e.length)?1:0),4<p&&"S"===t.mRound||4<p&&"A"===t.mRound&&""===i||5<p&&"A"===t.mRound&&"-"===i||5<p&&"s"===t.mRound||5<p&&"a"===t.mRound&&""===i||4<p&&"a"===t.mRound&&"-"===i||5<p&&"B"===t.mRound||5===p&&"B"===t.mRound&&1===d||0<p&&"C"===t.mRound&&""===i||0<p&&"F"===t.mRound&&"-"===i||0<p&&"U"===t.mRound||"CHF"===t.mRound)for(n=g.length-1;0<=n;n-=1)if("."!==g[n]){if("CHF"===t.mRound&&g[n]<=2&&f){g[n]=0,f=!1;break}if("CHF"===t.mRound&&g[n]<=7&&f){f=!(g[n]=5);break}if("CHF"===t.mRound&&f?f=!(g[n]=10):g[n]=+g[n]+1,g[n]<10)break;0<n&&(g[n]="0")}return 0==+(a=o((g=g.slice(0,h+1)).join("")))?a:i+a}function y(e,t){this.settings=t,this.that=e,this.$that=c(e),this.formatted=!1,this.settingsClone=a(this.$that,this.settings),this.value=e.value}function S(e){return"string"==typeof e&&(e="#"+(e=e.replace(/\[/g,"\\[").replace(/\]/g,"\\]")).replace(/(:|\.)/g,"\\$1")),c(e)}function N(e,t,a){var n=e.data("autoNumeric");n||(n={},e.data("autoNumeric",n));var i=n.holder;return(void 0===i&&t||a)&&(i=new y(e.get(0),t),n.holder=i),i}y.prototype={init:function(e){this.value=this.that.value,this.settingsClone=a(this.$that,this.settings),this.ctrlKey=e.ctrlKey,this.cmdKey=e.metaKey,this.shiftKey=e.shiftKey,this.selection=function(e){var t={};if(void 0===e.selectionStart){e.focus();var a=document.selection.createRange();t.length=a.text.length,a.moveStart("character",-e.value.length),t.end=a.text.length,t.start=t.end-t.length}else t.start=e.selectionStart,t.end=e.selectionEnd,t.length=t.end-t.start;return t}(this.that),"keydown"!==e.type&&"keyup"!==e.type||(this.kdCode=e.keyCode),this.which=e.which,this.processed=!1,this.formatted=!1},setSelection:function(e,t,a){e=Math.max(e,0),t=Math.min(t,this.that.value.length),this.selection={start:e,end:t,length:t-e},(void 0===a||a)&&r(this.that,e,t)},setPosition:function(e,t){this.setSelection(e,e,t)},getBeforeAfter:function(){var e=this.value;return[e.substring(0,this.selection.start),e.substring(this.selection.end,e.length)]},getBeforeAfterStriped:function(){var e=this.getBeforeAfter();return e[0]=u(e[0],this.settingsClone),e[1]=u(e[1],this.settingsClone),e},normalizeParts:function(e,t){var a=this.settingsClone;""!==(e=u(e,a,!!(t=u(t,a)).match(/^\d/)||"leading"))&&e!==a.aNeg||"deny"!==a.lZero||""<t&&(t=t.replace(/^0*(\d)/,"$1"));var n=e+t;if(a.aDec){var i=n.match(new RegExp("^"+a.aNegRegAutoStrip+"\\"+a.aDec));i&&(n=(e=e.replace(i[1],i[1]+"0"))+t)}return"zero"!==a.wEmpty||n!==a.aNeg&&""!==n||(e+="0"),[e,t]},setValueParts:function(e,t){var a=this.settingsClone,n=this.normalizeParts(e,t),i=n.join(""),r=n[0].length;return!!g(i,a)&&(r>(i=o(i,a.aDec,a.mDec)).length&&(r=i.length),this.value=i,this.setPosition(r,!1),!0)},signPosition:function(){var e=this.settingsClone,t=e.aSign,a=this.that;if(t){var n=t.length;if("p"===e.pSign)return e.aNeg&&a.value&&a.value.charAt(0)===e.aNeg?[1,n+1]:[0,n];var i=a.value.length;return[i-n,i]}return[1e3,-1]},expandSelectionOnSign:function(e){var t=this.signPosition(),a=this.selection;a.start<t[1]&&a.end>t[0]&&((a.start<t[0]||a.end>t[1])&&this.value.substring(Math.max(a.start,t[0]),Math.min(a.end,t[1])).match(/^\s*$/)?a.start<t[0]?this.setSelection(a.start,t[0],e):this.setSelection(t[1],a.end,e):this.setSelection(Math.min(a.start,t[0]),Math.max(a.end,t[1]),e))},checkPaste:function(){if(void 0!==this.valuePartsBeforePaste){var e=this.getBeforeAfter(),t=this.valuePartsBeforePaste;delete this.valuePartsBeforePaste,e[0]=e[0].substr(0,t[0].length)+u(e[0].substr(t[0].length),this.settingsClone),this.setValueParts(e[0],e[1])||(this.value=t.join(""),this.setPosition(t[0].length,!1))}},skipAllways:function(e){var t=this.kdCode,a=this.which,n=this.ctrlKey,i=this.cmdKey,r=this.shiftKey;if((n||i)&&"keyup"===e.type&&void 0!==this.valuePartsBeforePaste||r&&45===t)return this.checkPaste(),!1;if(112<=t&&t<=123||91<=t&&t<=93||9<=t&&t<=31||t<8&&(0===a||a===t)||144===t||145===t||45===t)return!0;if((n||i)&&65===t)return!0;if((n||i)&&(67===t||86===t||88===t))return"keydown"===e.type&&this.expandSelectionOnSign(),86!==t&&45!==t||("keydown"===e.type||"keypress"===e.type?void 0===this.valuePartsBeforePaste&&(this.valuePartsBeforePaste=this.getBeforeAfter()):this.checkPaste()),"keydown"===e.type||"keypress"===e.type||67===t;if(n||i)return!0;if(37!==t&&39!==t)return 34<=t&&t<=40;var o=this.settingsClone.aSep,s=this.selection.start,u=this.that.value;return"keydown"===e.type&&o&&!this.shiftKey&&(37===t&&u.charAt(s-2)===o?this.setPosition(s-1):39===t&&u.charAt(s+1)===o&&this.setPosition(s+1)),!0},processAllways:function(){var e;return(8===this.kdCode||46===this.kdCode)&&(this.selection.length?(this.expandSelectionOnSign(!1),e=this.getBeforeAfterStriped()):(e=this.getBeforeAfterStriped(),8===this.kdCode?e[0]=e[0].substring(0,e[0].length-1):e[1]=e[1].substring(1,e[1].length)),this.setValueParts(e[0],e[1]),!0)},processKeypress:function(){var e=this.settingsClone,t=String.fromCharCode(this.which),a=this.getBeforeAfterStriped(),n=a[0],i=a[1];return t===e.aDec||e.altDec&&t===e.altDec||("."===t||","===t)&&110===this.kdCode?e.mDec&&e.aDec&&(e.aNeg&&-1<i.indexOf(e.aNeg)||-1<n.indexOf(e.aDec)||0<i.indexOf(e.aDec)||(0===i.indexOf(e.aDec)&&(i=i.substr(1)),this.setValueParts(n+e.aDec,i))):"-"===t||"+"===t?e.aNeg&&(""===n&&-1<i.indexOf(e.aNeg)&&(n=e.aNeg,i=i.substring(1,i.length)),n=n.charAt(0)===e.aNeg?n.substring(1,n.length):"-"===t?e.aNeg+n:n,this.setValueParts(n,i)):"0"<=t&&t<="9"&&(e.aNeg&&""===n&&-1<i.indexOf(e.aNeg)&&(n=e.aNeg,i=i.substring(1,i.length)),e.vMax<=0&&e.vMin<e.vMax&&-1===this.value.indexOf(e.aNeg)&&"0"!==t&&(n=e.aNeg+n),this.setValueParts(n+t,i)),!0},formatQuick:function(){var e=this.settingsClone,t=this.getBeforeAfterStriped(),a=this.value;if((""===e.aSep||""!==e.aSep&&-1===a.indexOf(e.aSep))&&(""===e.aSign||""!==e.aSign&&-1===a.indexOf(e.aSign))){var n=[],i="";-1<(n=a.split(e.aDec))[0].indexOf("-")&&(i="-",n[0]=n[0].replace("-",""),t[0]=t[0].replace("-","")),n[0].length>e.mInt&&"0"===t[0].charAt(0)&&(t[0]=t[0].slice(1)),t[0]=i+t[0]}var r=f(this.value,this.settingsClone),o=r.length;if(r){for(var s=t[0].split(""),u=0;u<s.length;u+=1)s[u].match("\\d")||(s[u]="\\"+s[u]);var l=new RegExp("^.*?"+s.join(".*?")),c=r.match(l);c?(0===(o=c[0].length)&&r.charAt(0)!==e.aNeg||1===o&&r.charAt(0)===e.aNeg)&&e.aSign&&"p"===e.pSign&&(o=this.settingsClone.aSign.length+("-"===r.charAt(0)?1:0)):e.aSign&&"s"===e.pSign&&(o-=e.aSign.length)}this.that.value=r,this.setPosition(o),this.formatted=!0}};var t={init:function(i){return this.each(function(){var o=c(this),e=o.data("autoNumeric"),t=o.data();if("object"==typeof e)return this;if((e=c.extend({},{aNum:"0123456789",aSep:",",dGroup:"3",aDec:".",altDec:null,aSign:"",pSign:"p",vMax:"9999999999999.99",vMin:"0.00",mDec:null,mRound:"S",aPad:!0,nBracket:null,wEmpty:"empty",lZero:"allow",aForm:!0,onSomeEvent:function(){}},t,i)).aDec===e.aSep)return c.error("autoNumeric will not function properly when the decimal character aDec: '"+e.aDec+"' and thousand separator aSep: '"+e.aSep+"' are the same character"),this;o.data("autoNumeric",e),e.runOnce=!1;var a=N(o,e);if(-1===c.inArray(o.prop("tagName").toLowerCase(),e.tagList)&&"input"!==o.prop("tagName").toLowerCase())return c.error("The <"+o.prop("tagName").toLowerCase()+"> is not supported by autoNumeric()"),this;if(!1===e.runOnce&&e.aForm){if(o.is("input[type=text], input[type=hidden], input[type=tel], input:not([type])")){var n=!0;""===o[0].value&&"empty"===e.wEmpty&&(o[0].value="",n=!1),""===o[0].value&&"sign"===e.wEmpty&&(o[0].value=e.aSign,n=!1),n&&o.autoNumeric("set",o.val())}-1!==c.inArray(o.prop("tagName").toLowerCase(),e.tagList)&&""!==o.text()&&o.autoNumeric("set",o.text())}e.runOnce=!0,o.is("input[type=text], input[type=hidden], input[type=tel], input:not([type])")&&(o.on("keydown.autoNumeric",function(e){return(a=N(o)).settings.aDec===a.settings.aSep?(c.error("autoNumeric will not function properly when the decimal character aDec: '"+a.settings.aDec+"' and thousand separator aSep: '"+a.settings.aSep+"' are the same character"),this):a.that.readOnly?a.processed=!0:(a.init(e),a.settings.oEvent="keydown",a.skipAllways(e)?a.processed=!0:a.processAllways()?(a.processed=!0,a.formatQuick(),e.preventDefault(),!1):!(a.formatted=!1))}),o.on("keypress.autoNumeric",function(e){var t=N(o),a=t.processed;return t.init(e),t.settings.oEvent="keypress",!!t.skipAllways(e)||(a?(e.preventDefault(),!1):t.processAllways()||t.processKeypress()?(t.formatQuick(),e.preventDefault(),!1):void(t.formatted=!1))}),o.on("keyup.autoNumeric",function(e){var t=N(o);t.init(e),t.settings.oEvent="keyup";var a=t.skipAllways(e);return t.kdCode=0,delete t.valuePartsBeforePaste,o[0].value===t.settings.aSign&&("s"===t.settings.pSign?r(this,0,0):r(this,t.settings.aSign.length,t.settings.aSign.length)),!!a||(""===this.value||void(t.formatted||t.formatQuick()))}),o.on("focusin.autoNumeric",function(){var e=N(o);if(e.settingsClone.oEvent="focusin",null!==e.settingsClone.nBracket){var t=o.val();o.val(l(t,e.settingsClone.nBracket,e.settingsClone.oEvent))}e.inVal=o.val();var a=d(e.inVal,e.settingsClone,!0);null!==a&&(o.val(a),"s"===e.settings.pSign?r(this,0,0):r(this,e.settings.aSign.length,e.settings.aSign.length))}),o.on("focusout.autoNumeric",function(){var e=N(o),t=e.settingsClone,a=o.val(),n=a;e.settingsClone.oEvent="focusout";var i="";"allow"===t.lZero&&(t.allowLeading=!1,i="leading"),""!==a&&(a=null===d(a=u(a,t,i),t)&&g(a,t,o[0])?p(a=m(a=s(a,t.aDec,t.aNeg),t),t.aDec,t.aNeg):"");var r=d(a,t,!1);null===r&&(r=f(a,t)),r!==n&&o.val(r),r!==e.inVal&&(o.change(),delete e.inVal),null!==t.nBracket&&o.autoNumeric("get")<0&&(e.settingsClone.oEvent="focusout",o.val(l(o.val(),t.nBracket,t.oEvent)))}))})},destroy:function(){return c(this).each(function(){var e=c(this);e.off(".autoNumeric"),e.removeData("autoNumeric")})},update:function(n){return c(this).each(function(){var e=S(c(this)),t=e.data("autoNumeric");if("object"!=typeof t)return c.error("You must initialize autoNumeric('init', {options}) prior to calling the 'update' method"),this;var a=e.autoNumeric("get");return N(e,t=c.extend(t,n),!0),t.aDec===t.aSep?(c.error("autoNumeric will not function properly when the decimal character aDec: '"+t.aDec+"' and thousand separator aSep: '"+t.aSep+"' are the same character"),this):(e.data("autoNumeric",t),""!==e.val()||""!==e.text()?e.autoNumeric("set",a):void 0)})},set:function(i){if(null!==i)return c(this).each(function(){var e=S(c(this)),t=e.data("autoNumeric"),a=i.toString(),n=i.toString();return"object"!=typeof t?(c.error("You must initialize autoNumeric('init', {options}) prior to calling the 'set' method"),this):(n!==e.attr("value")&&"input"===e.prop("tagName").toLowerCase()&&!1===t.runOnce&&(a=u(a=null!==t.nBracket?l(e.val(),t.nBracket,"pageLoad"):a,t)),n!==e.attr("value")&&n!==e.text()||!1!==t.runOnce||(a=a.replace(",",".")),c.isNumeric(+a)?(a=h(a,t),t.oEvent="set",a.toString(),""!==a&&(a=m(a,t)),g(a=p(a,t.aDec,t.aNeg),t)||(a=m("",t)),a=f(a,t),e.is("input[type=text], input[type=hidden], input[type=tel], input:not([type])")?e.val(a):-1!==c.inArray(e.prop("tagName").toLowerCase(),t.tagList)?e.text(a):(c.error("The <"+e.prop("tagName").toLowerCase()+"> is not supported by autoNumeric()"),!1)):"")})},get:function(){var e=S(c(this)),t=e.data("autoNumeric");if("object"!=typeof t)return c.error("You must initialize autoNumeric('init', {options}) prior to calling the 'get' method"),this;t.oEvent="get";var a="";if(e.is("input[type=text], input[type=hidden], input[type=tel], input:not([type])"))a=e.eq(0).val();else{if(-1===c.inArray(e.prop("tagName").toLowerCase(),t.tagList))return c.error("The <"+e.prop("tagName").toLowerCase()+"> is not supported by autoNumeric()"),!1;a=e.eq(0).text()}return""===a&&"empty"===t.wEmpty||a===t.aSign&&("sign"===t.wEmpty||"empty"===t.wEmpty)?"":(null!==t.nBracket&&""!==a&&(a=l(a,t.nBracket,t.oEvent)),(t.runOnce||!1===t.aForm)&&(a=u(a,t)),0==+(a=s(a,t.aDec,t.aNeg))&&"keep"!==t.lZero&&(a="0"),"keep"===t.lZero?a:a=h(a,t))},getString:function(){for(var e=!1,t=S(c(this)),a=t.serialize(),n=a.split("&"),i=c("form").index(t),r=0;r<n.length;r+=1){var o=n[r].split("="),s=c("form:eq("+i+') input[name="'+decodeURIComponent(o[0])+'"]');"object"==typeof s.data("autoNumeric")&&null!==o[1]&&(o[1]=s.autoNumeric("get"),n[r]=o.join("="),e=!0)}return!0===e?n.join("&"):a},getArray:function(){var n=!1,e=S(c(this)),t=e.serializeArray(),i=c("form").index(e);return c.each(t,function(e,t){var a=c("form:eq("+i+') input[name="'+decodeURIComponent(t.name)+'"]');"object"==typeof a.data("autoNumeric")&&(""!==t.value&&(t.value=a.autoNumeric("get").toString()),n=!0)}),!0===n?t:this},getSettings:function(){return S(c(this)).eq(0).data("autoNumeric")}};c.fn.autoNumeric=function(e){return t[e]?t[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void c.error('Method "'+e+'" is not supported by autoNumeric()'):t.init.apply(this,arguments)}}(jQuery);
|