var MONTH_NAMES="January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY_NAMES="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat".split(" ");function LZ(a){return(0>a||9<a?"":"0")+a}function isDate(a,b){return 0==getDateFromFormat(a,b)?!1:!0}function compareDates(a,b,d,h){a=getDateFromFormat(a,b);d=getDateFromFormat(d,h);return 0==a||0==d?-1:a>d?1:0}
function formatDate(a,b){var b=b+"",d="",h=0,c="",e="",c=a.getYear()+"",e=a.getMonth()+1,j=a.getDate(),i=a.getDay(),m=a.getHours(),k=a.getMinutes(),l=a.getSeconds(),f={};4>c.length&&(c=""+(c-0+1900));f.y=""+c;f.yyyy=c;f.yy=c.substring(2,4);f.M=e;f.MM=LZ(e);f.MMM=MONTH_NAMES[e-1];f.NNN=MONTH_NAMES[e+11];f.d=j;f.dd=LZ(j);f.E=DAY_NAMES[i+7];f.EE=DAY_NAMES[i];f.H=m;f.HH=LZ(m);f.h=0==m?12:12<m?m-12:m;f.hh=LZ(f.h);f.K=11<m?m-12:m;f.k=m+1;f.KK=LZ(f.K);f.kk=LZ(f.k);f.a=11<m?"PM":"AM";f.m=k;f.mm=LZ(k);f.s=
l;for(f.ss=LZ(l);h<b.length;){c=b.charAt(h);for(e="";b.charAt(h)==c&&h<b.length;)e+=b.charAt(h++);d=null!=f[e]?d+f[e]:d+e}return d}function _isInteger(a){for(var b=0;b<a.length;b++)if(-1=="1234567890".indexOf(a.charAt(b)))return!1;return!0}function _getInt(a,b,d,h){for(;h>=d;h--){var c=a.substring(b,b+h);if(c.length<d)break;if(_isInteger(c))return c}return null}
function getDateFromFormat(a,b){for(var a=a+"",b=b+"",d=0,h=0,c="",e="",j,i,m=new Date,k=m.getYear(),l=m.getMonth()+1,f=1,g=m.getHours(),n=m.getMinutes(),m=m.getSeconds(),o="";h<b.length;){c=b.charAt(h);for(e="";b.charAt(h)==c&&h<b.length;)e+=b.charAt(h++);if("yyyy"==e||"yy"==e||"y"==e){"yyyy"==e&&(i=j=4);"yy"==e&&(i=j=2);"y"==e&&(j=2,i=4);k=_getInt(a,d,j,i);if(null==k)return 0;d+=k.length;2==k.length&&(k=70<k?1900+(k-0):2E3+(k-0))}else if("MMM"==e||"NNN"==e){for(c=l=0;c<MONTH_NAMES.length;c++){var p=
MONTH_NAMES[c];if(a.substring(d,d+p.length).toLowerCase()==p.toLowerCase()&&("MMM"==e||"NNN"==e&&11<c)){l=c+1;12<l&&(l-=12);d+=p.length;break}}if(1>l||12<l)return 0}else if("EE"==e||"E"==e)for(c=0;c<DAY_NAMES.length;c++){if(e=DAY_NAMES[c],a.substring(d,d+e.length).toLowerCase()==e.toLowerCase()){d+=e.length;break}}else if("MM"==e||"M"==e){l=_getInt(a,d,e.length,2);if(null==l||1>l||12<l)return 0;d+=l.length}else if("dd"==e||"d"==e){f=_getInt(a,d,e.length,2);if(null==f||1>f||31<f)return 0;d+=f.length}else if("hh"==
e||"h"==e){g=_getInt(a,d,e.length,2);if(null==g||1>g||12<g)return 0;d+=g.length}else if("HH"==e||"H"==e){g=_getInt(a,d,e.length,2);if(null==g||0>g||23<g)return 0;d+=g.length}else if("KK"==e||"K"==e){g=_getInt(a,d,e.length,2);if(null==g||0>g||11<g)return 0;d+=g.length}else if("kk"==e||"k"==e){g=_getInt(a,d,e.length,2);if(null==g||1>g||24<g)return 0;d+=g.length;g--}else if("mm"==e||"m"==e){n=_getInt(a,d,e.length,2);if(null==n||0>n||59<n)return 0;d+=n.length}else if("ss"==e||"s"==e){m=_getInt(a,d,e.length,
2);if(null==m||0>m||59<m)return 0;d+=m.length}else if("a"==e){if("am"==a.substring(d,d+2).toLowerCase())o="AM";else if("pm"==a.substring(d,d+2).toLowerCase())o="PM";else return 0;d+=2}else{if(a.substring(d,d+e.length)!=e)return 0;d+=e.length}}if(d!=a.length)return 0;if(2==l)if(0==k%4&&0!=k%100||0==k%400){if(29<f)return 0}else if(28<f)return 0;if((4==l||6==l||9==l||11==l)&&30<f)return 0;12>g&&"PM"==o?g=g-0+12:11<g&&"AM"==o&&(g-=12);return(new Date(k,l-1,f,g,n,m)).getTime()}
function parseDate(a){var b=2==arguments.length?arguments[1]:!1;generalFormats="y-M-d;MMM d, y;MMM d,y;y-MMM-d;d-MMM-y;MMM d".split(";");monthFirst="M/d/y M-d-y M.d.y MMM-d M/d M-d".split(" ");dateFirst="d/M/y d-M-y d.M.y d-MMM d/M d-M".split(" ");for(var b=["generalFormats",b?"dateFirst":"monthFirst",b?"monthFirst":"dateFirst"],d=null,h=0;h<b.length;h++)for(var c=window[b[h]],e=0;e<c.length;e++)if(d=getDateFromFormat(a,c[e]),0!=d)return new Date(d);return null};function Stack(){this.arrStack=[];this.intIndex=0;this.Size=getSize;this.IsEmpty=isStackEmpty;this.Push=pushElement;this.Pop=popElement;this.Get=getElement;this.toString=dumpStack}function dumpStack(){var a=0,b="";if(0==this.intIndex)return null;for(a=0;a<this.intIndex;a++)b=0==b.length?b+this.arrStack[a]:b+(","+this.arrStack[a]);return b}function getSize(){return this.intIndex}function isStackEmpty(){return 0==this.intIndex?!0:!1}
function pushElement(a){debugAssert("Pushing "+a);this.arrStack[this.intIndex]=a;this.intIndex++}function popElement(){var a;a=null;0<this.intIndex&&(this.intIndex--,a=this.arrStack[this.intIndex]);return a}function getElement(a){var b;0<=a&&a<this.intIndex&&(b=this.arrStack[this.intIndex-a-1]);return b};var lstAlpha="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,uv,w,x,y,z",lstDigits="0,1,2,3,4,5,6,7,8,9",lstArithOps="^,*,/,%,+,-",lstLogicOps="!,&,|",lstCompaOps="<,<=,>,>=,<>,=",lstFuncOps="AVG ABS ACOS ASC ASIN ATAN CDATE CHR COS DATE FIX HEX IIF LCASE LEFT LOG MAX MID MIN RIGHT ROUND SIN SQRT TAN UCASE".split(" ");
function Tokanize(a){var b,d,h,c,e,j,i,m;c=d=b=0;i="";h=[];for(a=Trim(a);b<a.length;){m="";e=a.substr(b,1);window&&window.status&&(window.status="Processing "+e);switch(e){case " ":0<i.length&&(h[c]=i,c++,i="");break;case "(":d++;0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case ")":d--;0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case "^":0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case "*":0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case "/":0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;
case "%":0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case "&":0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case "|":0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case ",":0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case "-":0<i.length&&(h[c]=i,c++,i="");j=a.substr(b+1,1);0<h.length&&(m=h[c-1]);0==b||(IsOperator(m)||"("==m||","==m)&&(IsDigit(j)||"("==j)?i+=e:(h[c]=e,c++,i="");break;case "+":0<i.length&&(h[c]=i,c++,i="");j=a.substr(b+1,1);0<h.length&&(m=h[c-1]);0==b||(IsOperator(m)||"("==m||
","==m)&&(IsDigit(j)||"("==j)?i+=e:(h[c]=e,c++,i="");break;case "<":j=a.substr(b+1,1);0<i.length&&(h[c]=i,c++,i="");"="==j?(h[c]=e+"=",c++,b++):">"==j?(h[c]=e+">",c++,b++):(h[c]=e,c++);break;case ">":j=a.substr(b+1,1);0<i.length&&(h[c]=i,c++,i="");"="==j?(h[c]=e+"=",c++,b++):(h[c]=e,c++);break;case "=":0<i.length&&(h[c]=i,c++,i="");h[c]=e;c++;break;case "'":0<i.length&&(h[c]=i,c++,i="");e=a.indexOf(e,b+1);if(0>e)throw"Unterminated string constant";i+=a.substring(b+1,e);h[c]=i;c++;i="";b=e;break;case '"':0<
i.length&&(h[c]=i,c++,i="");e=a.indexOf(e,b+1);if(0>e)throw"Unterminated string constant";i+=a.substring(b+1,e);h[c]=i;c++;i="";b=e;break;default:i+=e}b++}if(0<d)throw"Unbalanced parenthesis!";0<i.length&&(h[c]=i);return h}function IsDigit(a){return 0<=lstDigits.indexOf(a)?!0:!1}function IsAlpha(a){return 0<=lstAlpha.indexOf(a)||0<=lstAlpha.toUpperCase().indexOf(a)?!0:!1}function IsOperator(a){return 0<=lstArithOps.indexOf(a)||0<=lstCompaOps.indexOf(a)?!0:!1}
function IsFunction(a){for(var b=0,a=a.toUpperCase(),b=0;b<lstFuncOps.length;b++)if(a==lstFuncOps[b])return!0;return!1}function Trim(a){if(1>a.length)return"";a=RTrim(a);a=LTrim(a);return""==a?"":a}function RTrim(a){var b=String.fromCharCode(32),d=a.length,h="";if(0>d)return"";for(d-=1;-1<d;){if(a.charAt(d)!=b){h=a.substring(0,d+1);break}d-=1}return h}
function LTrim(a){var b=String.fromCharCode(32);if(1>d)return"";for(var d=a.length,h="",c=0;c<d;){if(a.charAt(c)!=b){h=a.substring(c,d);break}c+=1}return h};var UNARY_NEG="\ufffd",ARG_TERMINAL="\ufffd",LESS_THAN="\ufffd",GREATER_THAN="\ufffd",NOT_EQUAL="\ufffd",DEBUG_ON=!1,NUMARIC_OP="*,/,%,^";
function Expression(){function a(){c=Tokanize(d);if(null==c||void 0==c)throw"Unable to tokanize the expression!";if(0>=c.length)throw"Unable to tokanize the expression!";var a=c,b,h,l,f,g;l=0;arrPFix=[];b=new Stack;for(h=0;h<a.length;h++){f=a[h];debugAssert("Processing token ["+f+"]");switch(f){case "(":0<b.Size()&&IsFunction(b.Get(0))&&(arrPFix[l]=ARG_TERMINAL,l++);b.Push(f);break;case ")":g=!0;for(debugAssert("Stack.Pop ["+b.toString());!b.IsEmpty();)if(f=b.Pop(),"("!=f)arrPFix[l]=f,l++;else{g=
!1;break}if(b.IsEmpty()&&g)throw"Unbalanced parenthesis!";break;case ",":if(b.IsEmpty())break;for(debugAssert("Pop stack till opening bracket found!");!b.IsEmpty();){f=b.Get(0);if("("==f)break;arrPFix[l]=b.Pop();l++}break;case "!":case "-":if("-"==f&&(g=null,0<h&&(g=a[h-1]),null==g||IsOperator(g)||"("==g))debugAssert("Unary negation!"),f=UNARY_NEG;case "^":case "*":case "/":case "%":case "+":if("+"==f&&(g=null,0<h&&(g=a[h-1]),null==g||IsOperator(g)||"("==g)){debugAssert("Unary add, Skipping");break}case "&":case "|":case ">":case "<":case "=":case ">=":case "<=":case "<>":g=
"";b.IsEmpty()||(g=b.Get(0));if(b.IsEmpty()||!b.IsEmpty()&&"("==g)debugAssert("Empty stack pushing operator ["+f+"]");else if(Precedence(f)>Precedence(g))debugAssert("["+f+"] has higher precedence over ["+g+"]");else for(;!b.IsEmpty();)if(g=b.Get(0),"("==g||Precedence(g)<Precedence(f)){debugAssert("["+g+"] has lesser precedence over ["+f+"]");break}else arrPFix[l]=b.Pop(),l++;b.Push(f);break;default:if(IsFunction(f)){g="";b.IsEmpty()||(g=b.Get(0));if(b.IsEmpty()||!b.IsEmpty()&&"("==g)debugAssert("Empty stack pushing operator ["+
f+"]");else if(Precedence(f)>Precedence(g))debugAssert("["+f+"] has higher precedence over ["+g+"]");else for(;!b.IsEmpty();)if(g=b.Get(0),"("==g||Precedence(g)<Precedence(f)){debugAssert("["+g+"] has lesser precedence over ["+f+"]");break}else arrPFix[l]=b.Pop(),l++;b.Push(f)}else debugAssert("Token ["+f+"] is a variable/number!"),IsNumber(f)?f=ToNumber(f):IsBoolean(f)?f=ToBoolean(f):isDate(f,j)&&(f=getDateFromFormat(f,j)),arrPFix[l]=f,l++}debugAssert("Stack   : "+b.toString()+"\nRPN Exp : "+arrPFix.toString())}for(;!b.IsEmpty();)arrPFix[l]=
b.Pop(),l++;e=arrPFix;if(null==e||void 0==e)throw"Unable to convert the expression to postfix form!";if(0>=e.length)throw"Unable to convert the expression to postfix form!";return e.toString()}function b(a){var b;debugAssert(a);if(null==h||void 0==h)throw"Variable values are not supplied!";b=h[a];if(void 0==b||null==b)throw"Variable ["+a+"] not defined";debugAssert(a+" - "+b);return b}var d=null,h=null,c=null,e=null,j="dd/MM/yyyy";this.DateFormat=function(a){j=a};this.Expression=function(a){d=a};
this.Parse=a;this.Evaluate=function(){var c,d,k,l,f,g,n;(null==e||void 0==e)&&a();if(0==e.length)throw"Unable to parse the expression!";n=e;if(null==n||void 0==n)throw"Invalid postfix expression!";if(0==n.length)throw"Invalid postfix expression!";c=0;for(d=new Stack;c<n.length;){k=n[c];switch(k){case ARG_TERMINAL:d.Push(k);break;case UNARY_NEG:if(d.IsEmpty())throw"No operand to negate!";f=d.Pop();IsVariable(f)&&(f=b(f));k=ToNumber(f);if(isNaN(k))throw"Not a numaric value!";k=0-k;d.Push(k);break;case "!":if(d.IsEmpty())throw"No operand on stack!";
f=d.Pop();IsVariable(f)&&(f=b(f));f=ToBoolean(f);if(null==f)throw"Not a boolean value!";d.Push(!f);break;case "*":case "/":case "%":case "^":if(d.IsEmpty()||2>d.Size())throw"Stack is empty, can not perform ["+k+"]";objTmp=null;g=d.Pop();f=d.Pop();IsVariable(f)&&(f=b(f));IsVariable(g)&&(g=b(g));f=ToNumber(f);g=ToNumber(g);if(isNaN(f)||isNaN(g))throw"Either one of the operand is not a number can not perform ["+k+"]";"^"==k?d.Push(Math.pow(f,g)):"*"==k?d.Push(f*g):"/"==k?d.Push(f/g):(debugAssert(f+" - "+
g),d.Push(f%g));break;case "+":case "-":if(d.IsEmpty()||2>d.Size())throw"Stack is empty, can not perform ["+k+"]";l="+"==k?"Addition":"Substraction";g=d.Pop();f=d.Pop();IsVariable(f)&&(f=b(f));IsVariable(g)&&(g=b(g));if(IsBoolean(f)||IsBoolean(g))throw"Can not perform "+l+" with boolean values!";if(isDate(f,j)&&isDate(f,j))throw l+" of two dates not supported!";if("object"==typeof f||"object"==typeof f)throw l+" of two objects not supported!";if("undefined"==typeof f||"undefined"==typeof f)throw l+
" of two undefined not supported!";if(IsNumber(f)&&IsNumber(g))f=ToNumber(f),g=ToNumber(g),"+"==k?d.Push(f+g):d.Push(f-g);else if("+"==k)d.Push(f+g);else throw strOP+" not supported for strings!";break;case "=":case "<":case ">":case "<>":case "<=":case ">=":if(d.IsEmpty()||2>d.Size())throw"Stack is empty, can not perform ["+k+"]";g=d.Pop();f=d.Pop();IsVariable(f)&&(f=b(f));IsVariable(g)&&(g=b(g));if(IsNumber(f)&&IsNumber(g))f=ToNumber(f),g=ToNumber(g),"="==k?d.Push(f==g):"<>"==k?d.Push(f!=g):">"==
k?d.Push(f>g):"<"==k?d.Push(f<g):"<="==k?d.Push(f<=g):">="==k&&d.Push(f>=g);else if(IsBoolean(f)&&IsBoolean(g)&&("="==k||"<>"==k))l=ToBoolean(f),g=ToBoolean(g),"="==k?d.Push(l==g):"<>"==k&&d.Push(l!=g);else if(isDate(f,j)&&isDate(g,j))l="string"==typeof f?getDateFromFormat(f,j):f,g="string"==typeof f?getDateFromFormat(g,j):g,"="==k?d.Push(l==g):"<>"==k?d.Push(l!=g):">"==k?d.Push(l>g):"<"==k?d.Push(l<g):"<="==k?d.Push(l<=g):">="==k&&d.Push(l>=g);else if("string"==typeof f&&"string"==typeof g&&("="==
k||"<>"==k))"="==k?d.Push(f==g):"<>"==k&&d.Push(f!=g);else throw"For "+k+" operator LHS & RHS should be of same data type!";break;case "&":case "|":if(d.IsEmpty()||2>d.Size())throw"Stack is empty, can not perform ["+k+"]";g=d.Pop();f=d.Pop();IsVariable(f)&&(f=b(f));IsVariable(g)&&(g=b(g));if(IsBoolean(f)&&IsBoolean(g))l=ToBoolean(f),g=ToBoolean(g),"&"==k?d.Push(l&&g):"|"==k&&d.Push(l||g);else throw"Logical operator requires LHS & RHS of boolean type!";break;default:IsNumber(k)||IsBoolean(k)||isDate(k,
j)||"number"==typeof k||"boolean"==typeof k||"object"==typeof k||IsVariable(k)?d.Push(k):HandleFunctions(k,d,j,h)}c++}if(d.IsEmpty()||1<d.Size())throw"Unable to evaluate expression!";return d.Pop()};this.AddVariable=function(a,b){if(null==h||void 0==h)h=[];h[a]=b};this.Reset=function(){e=c=d=h=null}}
function HandleFunctions(a,b,d,h){var c,e,j;if(!IsFunction(a))throw"Unsupported function token ["+a+"]";c=a.toUpperCase();for(j=[];!b.IsEmpty();)if(a=b.Pop(),a!=ARG_TERMINAL)j[j.length]=a;else break;switch(c){case "DATE":a=new Date;b.Push(formatDate(a,d));break;case "ACOS":case "ASIN":case "ATAN":throw"Function ["+c+"] is not implemented!";case "ABS":case "CHR":case "COS":case "FIX":case "HEX":case "LOG":case "ROUND":case "SIN":case "SQRT":case "TAN":if(1>j.length)throw c+" requires atleast one argument!";
if(1<j.length)throw c+" requires only one argument!";a=j[0];if(IsVariable(a)){e=h[a];if(void 0==e||null==e)throw"Variable ["+a+"] not defined";a=e}if(IsNumber(a))e=ToNumber(a),"ABS"==c?b.Push(Math.abs(e)):"CHR"==c?b.Push(String.fromCharCode(e)):"COS"==c?b.Push(Math.cos(e)):"FIX"==c?b.Push(Math.floor(e)):"HEX"==c?b.Push(e.toString(16)):"LOG"==c?b.Push(Math.log(e)):"ROUND"==c?b.Push(Math.round(e)):"SIN"==c?b.Push(Math.sin(e)):"SQRT"==c?b.Push(Math.sqrt(e)):"TAN"==c&&b.Push(Math.tan(e));else throw c+
" operates on numeric operands only!";break;case "ASC":if(1<j.length)throw c+" requires only one argument!";if(1>j.length)throw c+" requires atleast one argument!";a=j[0];if(IsVariable(a)){e=h[a];if(void 0==e||null==e)throw"Variable ["+a+"] not defined";a=e}if(IsNumber(a)||IsBoolean(a)||isDate(a,d)||"string"!=typeof a)throw c+" requires a string type operand!";b.Push(a.charCodeAt(0));break;case "LCASE":case "UCASE":case "CDATE":if(1>j.length)throw c+" requires atleast one argument!";if(1<j.length)throw c+
" requires only one argument!";a=j[0];if(IsVariable(a)){e=h[a];if(void 0==e||null==e)throw"Variable ["+a+"] not defined";a=e}if("CDATE"==c&&!isDate(a,d))throw"CDate can not convert ["+a+"] to a valid date!";if("number"==typeof a||"string"!=typeof a)throw c+" requires a string type operand!";"LCASE"==c?b.Push(a.toLowerCase()):"UCASE"==c?b.Push(a.toUpperCase()):"CDATE"==c&&(e=getDateFromFormat(a,d),b.Push(new Date(e)));break;case "LEFT":case "RIGHT":if(2>j.length)throw c+" requires atleast two arguments!";
if(2<j.length)throw c+" requires only two arguments!";for(d=0;d<j.length;d++){a=j[d];if(IsVariable(a)){e=h[a];if(void 0==e||null==e)throw"Variable ["+a+"] not defined";a=e}if(0==d&&!IsNumber(a))throw c+" oprator requires numaric length!";j[d]=a}a=new String(j[1]);e=ToNumber(j[0]);"LEFT"==c?b.Push(c.substring(0,e)):b.Push(c.substr(a.length-e,e));break;case "MID":case "IIF":if(3>j.length)throw c+" requires atleast three arguments!";if(3<j.length)throw c+" requires only three arguments!";for(d=0;d<j.length;d++){a=
j[d];if(IsVariable(a)){e=h[a];if(void 0==e||null==e)throw"Variable ["+a+"] not defined";a=e}if("MID"==a&&1>=d&&!IsNumber(a))throw c+" oprator requires numaric lengths!";if("IIF"==a&&2==d&&!IsBoolean(a))throw c+" oprator requires boolean condition!";j[d]=a}"MID"==c?(a=new String(j[2]),h=ToNumber(j[1]),j=ToNumber(j[0]),b.Push(a.substring(h,j))):(a=ToBoolean(j[2]),h=j[1],j=j[0],a?b.Push(h):b.Push(j));break;case "AVG":case "MAX":case "MIN":if(2>j.length)throw c+" requires atleast two operands!";for(d=
e=0;d<j.length;d++){a=j[d];if(IsVariable(a)){e=h[a];if(void 0==e||null==e)throw"Variable ["+a+"] not defined";a=e}if(!IsNumber(a))throw c+" requires numaric operands only!";a=ToNumber(a);"AVG"==c?e+=a:"MAX"==c&&e<a?e=a:"MIN"==c&&(1==d?e=a:e>a&&(e=a))}"AVG"==c?b.Push(e/j.length):b.Push(e)}}function IsNumber(a){var b=Number.NaN,b=new Number(a);return isNaN(b)?!1:!0}
function IsBoolean(a){var b=typeof a,d=null;return"boolean"==b?!0:"number"==b||("function"==b||void 0==b)||IsNumber(a)?!1:"object"==b&&(d=a.toString(),"TRUE"==d.toUpperCase()||"FALSE"==d.toUpperCase())?!0:"TRUE"==a.toUpperCase()||"FALSE"==a.toUpperCase()?!0:!1}
function IsVariable(a){return 0<=lstArithOps.indexOf(a)||0<=lstLogicOps.indexOf(a)||0<=lstCompaOps.indexOf(a)||"string"==typeof a&&("TRUE"==a.toUpperCase()||"FALSE"==a.toUpperCase()||null!=parseDate(a))||"number"==typeof a||"boolean"==typeof a||"object"==typeof a||IsNumber(a)||IsFunction(a)?!1:!0}function ToNumber(a){var b=Number.NaN;if("number"==typeof a)return a;b=new Number(a);return b.valueOf()}
function ToBoolean(a){var b=Number.NaN,b=null;if(null==a||void 0==a)throw"Boolean value is not defined!";return"boolean"==typeof a?a:"number"==typeof a?0<pobjval:IsNumber(a)?(b=ToNumber(a),isNaN(b)?null:0<b):"object"==typeof a?(b=a.toString(),"TRUE"==b.toUpperCase()?!0:"FALSE"==b.toUpperCase()?!1:null):"string"==typeof a?"TRUE"==a.toUpperCase()?!0:"FALSE"==a.toUpperCase()?!1:null:null}
function Precedence(a){var b=0;switch(a){case "+":case "-":b=5;break;case "*":case "/":case "%":b=6;break;case "^":b=7;break;case UNARY_NEG:case "!":b=10;break;case "(":b=99;break;case "&":case "|":b=3;break;case ">":case ">=":case "<":case "<=":case "=":case "<>":b=4;break;default:b=IsFunction(a)?9:0}debugAssert("Precedence of "+a+" is "+b);return b}function debugAssert(a){DEBUG_ON&&alert(a.toString())};

/**
JavaScript Mathematical Expression Evaluator
Includes software, which is Copyright (c) 2005 - 2012 Khan Information Systems (KIS) and others. All rights reserved.
 */

