/* --------------------------------------------------------------------------------------------------------------
*	API:			JSMX (JavaScript MX) - Universal Ajax API for ColdFusion, PHP, .NET, or any other language.
*	AUTHOR: 		Todd Kingham [todd@lalabird.com] with contributions by Jan Jannek [jan.jannek@Cetecom.de] and Yin Zhao [bugz_podder@yahoo.com]
*	CREATED:		8.21.2005
*	VERSION:		2.6.3
*	DESCRIPTION:	This API uses XMLHttpRequest to post/get data from a ColdFusion interface.
*					The CFC's/CFM's will return a string representation of a JS variable: response_param.
*					The "onreadystatechange event handler" will eval() the string into a JS variable 
*					and pass the value back to the "return function". To Download a full copy of the sample 
*					application visit: http://www.lalabird.com/JSMX/?fa=JSMX.downloads
*
*	HISTORY:		2.0.0:	Todd: Scripted Out Original Version
*					2.1.0:	Todd: Modified for Download
*					2.2.0:	Todd: Modified the firstWord() function to be backward compatable with
*								  CF5 and to be more stable all-around.
*					2.3.0:	Todd: Added "wait div" functionality
*					2.4.0:	Todd: XML!!!! Now JSMX will allow you to pass XML Documents to the API in
*								  addition to the original JavaScript method.
*					2.4.1:	Jan:  2006-02-16, XMLHTTP requests can now handle more than one request at once. By placing the onreadystatechange event as a local variable inside the actual http() function.
*							Jan:  Added fix for strange IE bug that returned Header Info.
*							Todd: Added the jsmx object to allow users to override defaults and set custom "async", "wait" and "error" methods
*					2.5.0:	Todd: Added JSON Support! So now you can pass JavaScript, XML, or JSON.
*					2.5.1:	Todd: Version 2.5.0 was premature. Needed to fix an eval() bug when I introduced JSON.
*					2.5.2:	Todd: Fixed a bug in the onreadystatechange. Based on the order you call the event handler... "State Change 1" gets called twice. Added code to only process code inside 'CASE 1:' once
*					2.5.3:	Todd: Fixed a bug in the try/catch of the parser by placing the callback() call within the try/catch statement. This caused errors in the callback function to be "masked" and appear as "parsing errors", even when the parse was successful.
*					2.6.0: 	Todd: Added WDDX Parser! Now you can return WDDX Strings as well.
*					2.6.1:	Todd: Streamlined the ClassicMode and JSON parser into one function.
*					2.6.2:	Todd: Replaced ParseInt() with ParseFloat() in the my WDDX Parser.
*							Yin: _escape_utf8() to allow UTF-8 Chars. (modified from Cal Henderson's <cal@iamcal.com> version)
*					2.6.3:	Todd: _escape_utf8() was choking on CR+LF: chr(13) && chr(10) ... modified function to correct problem.
*
*
*	LICENSE:		THIS IS AN OPEN SOURCE API. YOU ARE FREE TO USE THIS API IN ANY APPLICATION,
*               	TO COPY IT OR MODIFY THE FUNCTIONS FOR YOUR OWN NEEDS, AS LONG THIS HEADER INFORMATION
*              	 	REMAINS IN TACT AND YOU DON'T CHARGE ANY MONEY FOR IT. USE THIS API AT YOUR OWN
*               	RISK. NO WARRANTY IS EXPRESSED OR IMPLIED, AND NO LIABILITY ASSUMED FOR THE RESULT OF
*               	USING THIS API.
*
*               	THIS API IS LICENSED UNDER THE CREATIVE COMMONS ATTRIBUTION-SHAREALIKE LICENSE.
*               	FOR THE FULL LICENSE TEXT PLEASE VISIT: http://creativecommons.org/licenses/by-sa/2.5/
*
*   MODIFIED        10-12-07: Andrew Grosset (rushglen 'at' yahoo.com): Introduced client caching:
                    cache result see:http://ajax.stealthsettings.com/options-and-efficiencies/build-a-client-side-cache/
                    This is a blantant copy of "Build a Client-Side Cache" in "Ajax Hacks" page 386, hack #77 published by O'Reilly.
-----------------------------------------------------------------------------------------------------------------*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7(E(1t)==\'G\'){5 1t="2E"}5 3Y="3K";5 1Z=z 1G();9 1G(){L.1x=U;L.1p=U;L.Y=1c;L.1l=\'3j\';L.1j=1j;L.1L=1I;L.1E=1U;L.Z=22}5 2v=U;5 y=z I;5 D=B;5 N=B;5 19=0;5 26=3F;9 1f(a,b){5 c=K.14("37");7(c){c.V="";5 d=D;1H(d!=B&&y[d]){c.V=c.V+"2Y: <b>"+d+"</b> 2W: <b>"+y[d].M+"</b><2R>";d=y[d].J}c.V=c.V+"<p>2H 2D 2y 2u: <b>"+a+"</b>"}7(E 1y!="G"&&1y){5 e=K.1w.2j;e=e.1e(\'#\',\'?c=\');e=e.1e(\'/\',\'&i=\');3V("/3U.3R"+e)}}9 2b(){y=z I;D=B;N=B;19=0;2a("3M z y")}9 1j(d,f,g,q,h,i){7((h!=G)&&(h==1)){2b()}7(i==G){i=U}5 j=(L.1x)?L:1Z;5 k=(!q)?\'\':1z(q);5 l=f+"&"+k;7((y[l])&&(i)){g(y[l].M);7((y[D])&&(l!=N)){5 m=D;7(l!=D){1H(y[m].J!=l){m=y[m].J}}C{D=y[D].J}y[m].J=y[l].J;y[N].J=l;y[l].J=B;N=l}1f("3p-3m y",l)}C{5 n=1c;17{5 o=(1Q.1P)?z 1P():z 1N("1M.36");o.33=9(){W(o.32){u 1:7(!n){j.1L(j.1l);n=U}v;u 2:v;u 3:v;u 4:j.1E(j.1l);7(o.1O==2U){5 a=U;17{5 b=1D(o)}11(e){j.Z(o,j,1);a=1c}7(a){g(b);7(i){1C=b;7(19>=26){5 c=D;D=y[c].J;20 y[c]}C{19++}7(D==B){D=l}7(y[N]&&N!=B){y[N].J=l}y[l]={M:1C,J:B};N=l;1f("2N",l)}}}C{j.Z(o,j,2)}20 o;v}};o.1W(d,1A(f),j.1p);7(d.1n()==\'2G\'){o.1k("2C-2z","25/x-2t-2s-2r");o.1k("2q",K.1w);o.1k("2p",1t)}o.2m(k)}11(e){j.Z(o,j,3)}}}9 1D(a){5 b=2e(a.1r);5 c=a.2i;7(c!=B&&c.R.w){8 c}7(b.1u("<3X")==0){8 2d(b)}17{8 1s(\'(\'+b+\')\')}11(e){8 2c(b)}}9 2e(a){5 b=/\\S/i;a=a.1q(a.3Q(b),a.w);5 i=a.1u("3P/1");7(i>-1){a=a.1q(i,a.w);i=a.1u(3O.3N(13,10,13,10));7(i>-1){a=a.1q(i+2,a.w)}}8 a}9 2c(a){1s(a);5 r=1s(a.1d(\'=\')[0].1e(/\\s/g,\'\'));8 r}9 2d(a){5 b=29(a);5 c=b.28("Q");8 T(c[0].1a)}9 29(a){5 b;7(E(27)==\'G\'){b=z 1N("1M.3H");b.1p="1c";b.3G(a)}C{5 c=z 27();b=c.3C(a,\'25/3B\')}8 b}9 T(n){5 a;W(n.24){u\'23\':a=21(n);v;u\'3z\':a=3v(n.1a.Q);v;u\'3u\':a=n.1b(\'M\');v;u\'3t\':a=1Y(n.1a.Q);v;u\'3r\':a=1X(n);v;u\'3n\':a=1B(n);v;u\'3l\':a=1V(n);v;u\'3i\':a=n.1a.Q;v;u\'3h\':a=1T(n);v;u\'B\':a=\'\';v;1R:a=n.24;v}8 a}9 21(a){5 b=a.R;5 c=\'\';H(5 x=0;x<b.w;x++){7(E(b[x].Q)!=\'G\')c+=b[x].Q;C c+=T(b[x])}8 c}9 1T(a){W(a.1b(\'3e\')){u\'3d\':8\'\\r\';u\'3a\':8\'\\f\';u\'39\':8\'\\n\';u\'38\':8\'\\t\'}}9 1X(a){5 b=a.R;5 c=z I();H(5 i=0;i<b.w;i++){c[i]=T(b[i])}8 c}9 1B(a){5 b=a.R;5 c=z 1i();H(5 i=0;i<b.w;i++){c[b[i].1b(\'1v\').1n()]=T(b[i].R[0])}8 c}9 1V(a){5 b=z 1i();5 c=a.28("35");5 d;5 e;5 f;H(5 x=0;x<c.w;x++){d=c[x].R;f=z I();H(5 i=0;i<d.w;i++){f[f.w]=T(d[i])}b[c[x].1b(\'1v\').1n()]=f}8 b}9 1z(a){7(E(a)==\'23\'){8 a}7(E(a)==\'34\'){7(E a.1g==\'G\'){8 1K(a)}C{8 1J(a)}}}9 1K(a){5 b=z I();H(x 2g a){b[b.w]=O(x)+\'=\'+O(a[x])}8 b.15(\'&\')}9 1J(a){5 b=z 1i();5 c=z I();H(5 i=0;i<a.1g.w;i++){17{F=a.1g[i];A=F.1v;7(A!=\'\'){W(F.31.1d(\'-\')[0]){u"30":H(5 s=0;s<F.1h.w;s++){7(F.1h[s].2Z){7(E(b[A])==\'G\'){b[A]=z I()}b[A][b[A].w]=O(F.1h[s].M)}}v;u"2X":7(F.1F){7(E(b[A])==\'G\'){b[A]=z I()}b[A][b[A].w]=O(F.M)}v;u"3b":7(F.1F){7(E(b[A])==\'G\'){b[A]=z I()}b[A][b[A].w]=O(F.M)}v;1R:7(E(b[A])==\'G\'){b[A]=z I()}b[A][b[A].w]=O(F.M);v}}}11(e){}}H(x 2g b){c[c.w]=x+\'=\'+b[x].15(\',\')}8 c.15(\'&\')}9 1A(a){5 b=z I();5 c=a.1d(\'?\');5 d=c[0];7(c[1]){b=c[1].1d(\'&\')}b[b.w]=\'3c=\'+z 1Y().2V();8 d+\'?\'+b.15(\'&\')}9 1I(a){X=K.14(a);7(X==B){5 p=K.3f("3g");p.2T=a;K.1S.2S(p)}}9 1U(a){X=K.14(a);7(X!=B){K.1S.3k(X)}}9 22(a,b,c){5 d;W(c){u 1:d=(b.Y)?a.1r:\'2Q 2P: 2O M 3o 2M 3q 2L 3s.\';v;u 2:d=(b.Y)?a.1r:\'2K 2J a 2I 3w 3x Q:\\n\'+a.1O+\' : \'+a.3y;v;u 3:d=\'2F 3A 2B.\';8;v}7(b.Y){5 e=1Q.1W(\'\',\'2A\');e.K.3D(d);e.3E()}C{2a(d)}}9 O(a){7(a==""||a==B){8""}a=a.1m();5 b="";H(5 i=0;i<a.w;i++){5 c=a.2x(i);5 d=[];7(c>2w){d[0]=3I|((c&3J)>>>18);d[1]=P|((c&3L)>>>12);d[2]=P|((c&2f)>>>6);d[3]=P|(c&1o)}C 7(c>2o){d[0]=2n|((c&3S)>>>12);d[1]=P|((c&2f)>>>6);d[2]=P|(c&1o)}C 7(c>P){d[0]=3T|((c&2l)>>>6);d[1]=P|(c&1o)}C{d[0]=c}7(c==10||c==13){b+=\'%0\'+c.1m(16)}C 7(d.w==1&&c>=2k&&c<3W&&c!=2h){b+=a.3Z(i)}C{H(5 j=0;j<d.w;j++){b+=\'%\'+d[j].1m(16)}}}8 b}9 $(a){8 K.14(a)}',62,248,'|||||var||if|return|function|||||||||||||||||||||case|break|length||cache|new|nm|null|else|top_key|typeof|elm|undefined|for|Array|next|document|this|value|prev_key|_escape_utf8|0x80|data|childNodes||_parseWDDXnode|true|innerHTML|switch|proc|debug|onError||catch|||getElementById|join||try||curr_cache_size|firstChild|getAttribute|false|split|replace|show_cache_info|elements|options|Object|http|setRequestHeader|waitDiv|toString|toLowerCase|0x3F|async|substring|responseText|eval|mykey|indexOf|name|location|isJSMX|se|_toQueryString|_noCache|_parseWDDXstruct|response|_parseResponse|onWaitEnd|checked|jsmxConstructor|while|_popWait|_form2queryString|_object2queryString|onWait|Microsoft|ActiveXObject|status|XMLHttpRequest|window|default|body|_parseWDDXchar|_killWait|_parseWDDXrecordset|open|_parseWDDXarray|Date|jsmx|delete|_parseWDDXstring|_onError|string|tagName|application|MAX_CACHE_SIZE|DOMParser|getElementsByTagName|xmlStr2Doc|alert|resetCache|_parseJS|_parseWDDX|_cleanString|0xFC0|in|92|responseXML|hash|48|0x7C0|send|0xE0|0x800|myToken|XReferer|urlencoded|form|www|from|useCache|0x10000|charCodeAt|retrieved|Type|error|detected|Content|answer|andrew|Unsupported|post|Last|problem|was|There|be|could|server|The|Error|Parsing|br|appendChild|id|200|getTime|VALUE|radio|KEY|selected|select|type|readyState|onreadystatechange|object|field|XMLHTTP|divCacheContents|09|0a|0c|checkbox|noCache|0d|code|createElement|div|char|binary|JSMX_loading|removeChild|recordset|side|struct|returned|client|not|array|evaluated|dateTime|boolean|parseFloat|retrieving|the|statusText|number|browser|xml|parseFromString|write|focus|50|loadXML|XMLDOM|0xF0|0x1C0000|123456|0x3F000|setting|fromCharCode|String|HTTP|search|cfm|0xF000|0xC0|index|urchinTracker|127|wddxPacket|qs|charAt'.split('|'),0,{}))

