Ti.App = {}; Ti.API = {}; Ti.App._listeners = {}; Ti.App._listener_id = 1; Ti.App.id = Ti.appId; Ti.App._xhr = XMLHttpRequest; Ti._broker = function(module,method,data) { try { var url = 'app://'+Ti.appId+'/_TiA0_'+Ti.pageToken+'/'+module+'/'+method+'?'+Ti.App._JSON(data,1); var xhr = new Ti.App._xhr(); xhr.open('GET',url,false); xhr.send(); } catch(X) { } }; Ti._hexish = function(a){var r='';var e=a.length;var c=0;var h;while(c0){r+='0'};r+=h;}return r;}; Ti._bridgeEnc = function(o){return '<'+Ti._hexish(o)+'>';}; Ti.App._JSON = function(object,bridge) { var type = typeof object; switch (type) { case 'undefined': case 'function': case 'unknown': return undefined; case 'number': case 'boolean': return object; case 'string': if (bridge===1) return Ti._bridgeEnc(object); return '\"'+object.replace(/\"/g,'\\\\\"').replace(/\\n/g,'\\\\n').replace(/\\r/g,'\\\\r')+'\"'; } if((object===null) || (object.nodeType==1)) return 'null'; if(object.constructor.toString().indexOf('Date') != -1) { return 'new Date(' + object.getTime() + ')'; } if(object.constructor.toString().indexOf('Array') != -1) { var res='[';var pre='';var len=object.length; for(var i=0;i