-
Notifications
You must be signed in to change notification settings - Fork 3
/
phonegap.0.9.6.min.js
1 lines (1 loc) · 51 KB
/
phonegap.0.9.6.min.js
1
var _anomFunkMap={};var _anomFunkMapNextId=0;function anomToNameFunk(fun){var funkId="f"+_anomFunkMapNextId++;var funk=function(){fun.apply(this,arguments);_anomFunkMap[funkId]=null;delete _anomFunkMap[funkId]};_anomFunkMap[funkId]=funk;return"_anomFunkMap."+funkId}function GetFunctionName(fn){if(typeof fn==="function"){var name=fn.name;if(!name){var m=fn.toString().match(/^\s*function\s+([^\s\(]+)/);name=m&&m[1]}if(name&&(window[name]===fn)){return name}else{return anomToNameFunk(fn)}}else{return null}}if(typeof PhoneGap==="undefined"){if(typeof(DeviceInfo)!=="object"){DeviceInfo={}}PhoneGap={queue:{ready:true,commands:[],timer:null},_constructors:[]};PhoneGap.resources={base:true};PhoneGap.hasResource=function(name){return PhoneGap.resources[name]};PhoneGap.addResource=function(name){PhoneGap.resources[name]=true};PhoneGap.available=DeviceInfo.uuid!=undefined;PhoneGap.addConstructor=function(func){var state=document.readyState;if((state=="loaded"||state=="complete")&&DeviceInfo.uuid!=null){func()}else{PhoneGap._constructors.push(func)}};(function(){var timer=setInterval(function(){var state=document.readyState;if((state=="loaded"||state=="complete")&&DeviceInfo.uuid!=null){clearInterval(timer);while(PhoneGap._constructors.length>0){var constructor=PhoneGap._constructors.shift();try{constructor()}catch(e){if(typeof(debug.log)=="function"){debug.log("Failed to run constructor: "+debug.processMessage(e))}else{alert("Failed to run constructor: "+e.message)}}}var e=document.createEvent("Events");e.initEvent("deviceready");document.dispatchEvent(e)}},1)})();PhoneGap.callbackId=0;PhoneGap.callbacks={};PhoneGap.callbackStatus={NO_RESULT:0,OK:1,CLASS_NOT_FOUND_EXCEPTION:2,ILLEGAL_ACCESS_EXCEPTION:3,INSTANTIATION_EXCEPTION:4,MALFORMED_URL_EXCEPTION:5,IO_EXCEPTION:6,INVALID_ACTION:7,JSON_EXCEPTION:8,ERROR:9};PhoneGap.exec=function(){PhoneGap.queue.commands.push(arguments);if(PhoneGap.queue.timer==null){PhoneGap.queue.timer=setInterval(PhoneGap.run_command,10)}};PhoneGap.run_command=function(){if(!PhoneGap.available||!PhoneGap.queue.ready){return}PhoneGap.queue.ready=false;if(!this.gapBridge){this.gapBridge=document.createElement("iframe");this.gapBridge.setAttribute("style","display:none;");this.gapBridge.setAttribute("height","0px");this.gapBridge.setAttribute("width","0px");this.gapBridge.setAttribute("frameborder","0");document.documentElement.appendChild(this.gapBridge)}var args=PhoneGap.queue.commands.shift();if(PhoneGap.queue.commands.length==0){clearInterval(PhoneGap.queue.timer);PhoneGap.queue.timer=null}var service;var callbackId=null;var start=0;try{if(args[0]==null||typeof args[0]==="function"){var success=args[0];var fail=args[1];service=args[2]+"."+args[3];args=args[4];callbackId=service+PhoneGap.callbackId++;if(success||fail){PhoneGap.callbacks[callbackId]={success:success,fail:fail}}}else{service=args[0];start=1}var uri=[];var dict=null;for(var i=start;i<args.length;i++){var arg=args[i];if(arg==undefined||arg==null){continue}if(typeof(arg)=="object"){dict=arg}else{uri.push(encodeURIComponent(arg))}}var next=callbackId!=null?("/"+callbackId+"/"):"/";var url="gap://"+service+next+uri.join("/");if(dict!=null){url+="?"+encodeURIComponent(JSON.stringify(dict))}this.gapBridge.src=url}catch(e){console.log("PhoneGapExec Error: "+e)}};PhoneGap.callbackSuccess=function(callbackId,args){if(PhoneGap.callbacks[callbackId]){if(args.status==PhoneGap.callbackStatus.OK){try{if(PhoneGap.callbacks[callbackId].success){PhoneGap.callbacks[callbackId].success(args.message)}}catch(e){console.log("Error in success callback: "+callbackId+" = "+e)}}if(!args.keepCallback){delete PhoneGap.callbacks[callbackId]}}};PhoneGap.callbackError=function(callbackId,args){if(PhoneGap.callbacks[callbackId]){try{if(PhoneGap.callbacks[callbackId].fail){PhoneGap.callbacks[callbackId].fail(args.message)}}catch(e){console.log("Error in error callback: "+callbackId+" = "+e)}if(!args.keepCallback){delete PhoneGap.callbacks[callbackId]}}};PhoneGap.clone=function(obj){if(!obj){return obj}if(obj instanceof Array){var retVal=new Array();for(var i=0;i<obj.length;++i){retVal.push(PhoneGap.clone(obj[i]))}return retVal}if(obj instanceof Function){return obj}if(!(obj instanceof Object)){return obj}if(obj instanceof Date){return obj}retVal=new Object();for(i in obj){if(!(i in retVal)||retVal[i]!=obj[i]){retVal[i]=PhoneGap.clone(obj[i])}}return retVal};PhoneGap.m_document_addEventListener=document.addEventListener;document.addEventListener=function(evt,handler,capture){var e=evt.toLowerCase();if(e==="unload"){PhoneGap.onUnload=function(e){return handler(e)}}else{PhoneGap.m_document_addEventListener.call(document,evt,handler,capture)}};PhoneGap.m_document_removeEventListener=document.removeEventListener;document.removeEventListener=function(evt,handler,capture){var e=evt.toLowerCase();if(e==="unload"){PhoneGap.onUnload=null}PhoneGap.m_document_removeEventListener.call(document,evt,handler,capture)};PhoneGap.fireEvent=function(type,target){var e=document.createEvent("Events");e.initEvent(type);target=target||document;if(target.dispatchEvent===undefined){target=document}target.dispatchEvent(e)}}if(!PhoneGap.hasResource("debugconsole")){PhoneGap.addResource("debugconsole");DebugConsole=function(isDeprecated){this.logLevel=DebugConsole.INFO_LEVEL;this.isDeprecated=isDeprecated?true:false};DebugConsole.ALL_LEVEL=1;DebugConsole.INFO_LEVEL=1;DebugConsole.WARN_LEVEL=2;DebugConsole.ERROR_LEVEL=4;DebugConsole.NONE_LEVEL=8;DebugConsole.prototype.setLevel=function(level){this.logLevel=level};DebugConsole.prototype.processMessage=function(message,maxDepth){if(maxDepth===undefined){maxDepth=0}if(typeof(message)!="object"){return(this.isDeprecated?"WARNING: debug object is deprecated, please use console object \n"+message:message)}else{function indent(str){return str.replace(/^/mg," ")}function makeStructured(obj,depth){var str="";for(var i in obj){try{if(typeof(obj[i])=="object"&&depth<maxDepth){str+=i+":\n"+indent(makeStructured(obj[i]))+"\n"}else{str+=i+" = "+indent(String(obj[i])).replace(/^ /,"")+"\n"}}catch(e){str+=i+" = EXCEPTION: "+e.message+"\n"}}return str}return((this.isDeprecated?"WARNING: debug object is deprecated, please use console object\n":"")+"Object:\n"+makeStructured(message,maxDepth))}};DebugConsole.prototype.log=function(message,maxDepth){if(PhoneGap.available&&this.logLevel<=DebugConsole.INFO_LEVEL){PhoneGap.exec("DebugConsole.log",this.processMessage(message,maxDepth),{logLevel:"INFO"})}else{console.log(message)}};DebugConsole.prototype.warn=function(message,maxDepth){if(PhoneGap.available&&this.logLevel<=DebugConsole.WARN_LEVEL){PhoneGap.exec("DebugConsole.log",this.processMessage(message,maxDepth),{logLevel:"WARN"})}else{console.error(message)}};DebugConsole.prototype.error=function(message,maxDepth){if(PhoneGap.available&&this.logLevel<=DebugConsole.ERROR_LEVEL){PhoneGap.exec("DebugConsole.log",this.processMessage(message,maxDepth),{logLevel:"ERROR"})}else{console.error(message)}};PhoneGap.addConstructor(function(){window.console=new DebugConsole();window.debug=new DebugConsole(true)})}if(!PhoneGap.hasResource("position")){PhoneGap.addResource("position");Position=function(coords,timestamp){this.coords=Coordinates.cloneFrom(coords);this.timestamp=timestamp||new Date().getTime()};Position.prototype.equals=function(other){return(this.coords&&other&&other.coords&&this.coords.latitude==other.coords.latitude&&this.coords.longitude==other.coords.longitude)};Position.prototype.clone=function(){return new Position(this.coords?this.coords.clone():null,this.timestamp?this.timestamp:new Date().getTime())};Coordinates=function(lat,lng,alt,acc,head,vel,altAcc){this.latitude=lat;this.longitude=lng;this.altitude=alt;this.accuracy=acc;this.heading=head;this.speed=vel;this.altitudeAccuracy=(altAcc!="undefined")?altAcc:null};Coordinates.prototype.clone=function(){return new Coordinates(this.latitude,this.longitude,this.altitude,this.accuracy,this.heading,this.speed,this.altitudeAccuracy)};Coordinates.cloneFrom=function(obj){return new Coordinates(obj.latitude,obj.longitude,obj.altitude,obj.accuracy,obj.heading,obj.speed,obj.altitudeAccuracy)};PositionOptions=function(enableHighAccuracy,timeout,maximumAge){this.enableHighAccuracy=enableHighAccuracy||false;this.timeout=timeout||10000;this.maximumAge=maximumAge||0};PositionError=function(code,message){this.code=code||0;this.message=message||""};PositionError.UNKNOWN_ERROR=0;PositionError.PERMISSION_DENIED=1;PositionError.POSITION_UNAVAILABLE=2;PositionError.TIMEOUT=3}if(!PhoneGap.hasResource("acceleration")){PhoneGap.addResource("acceleration");Acceleration=function(x,y,z){this.x=x;this.y=y;this.z=z;this.timestamp=new Date().getTime()};AccelerationOptions=function(){this.timeout=10000}}if(!PhoneGap.hasResource("accelerometer")){PhoneGap.addResource("accelerometer");Accelerometer=function(){this.lastAcceleration=new Acceleration(0,0,0)};Accelerometer.prototype.getCurrentAcceleration=function(successCallback,errorCallback,options){if(typeof successCallback=="function"){successCallback(this.lastAcceleration)}};Accelerometer.prototype._onAccelUpdate=function(x,y,z){this.lastAcceleration=new Acceleration(x,y,z)};Accelerometer.prototype.watchAcceleration=function(successCallback,errorCallback,options){var frequency=(options!=undefined&&options.frequency!=undefined)?options.frequency:10000;var updatedOptions={desiredFrequency:frequency};PhoneGap.exec("Accelerometer.start",options);return setInterval(function(){navigator.accelerometer.getCurrentAcceleration(successCallback,errorCallback,options)},frequency)};Accelerometer.prototype.clearWatch=function(watchId){PhoneGap.exec("Accelerometer.stop");clearInterval(watchId)};Accelerometer.install=function(){if(typeof navigator.accelerometer=="undefined"){navigator.accelerometer=new Accelerometer()}};Accelerometer.installDeviceMotionHandler=function(){if(!(window.DeviceMotionEvent==undefined)){return}var self=this;var devicemotionEvent="devicemotion";self.deviceMotionWatchId=null;self.deviceMotionListenerCount=0;self.deviceMotionLastEventTimestamp=0;var _addEventListener=window.addEventListener;var _removeEventListener=window.removeEventListener;var windowDispatchAvailable=!(window.dispatchEvent===undefined);var accelWin=function(acceleration){var evt=document.createEvent("Events");evt.initEvent(devicemotionEvent);evt.acceleration=null;evt.rotationRate=null;evt.accelerationIncludingGravity=acceleration;var currentTime=new Date().getTime();evt.interval=(self.deviceMotionLastEventTimestamp==0)?0:(currentTime-self.deviceMotionLastEventTimestamp);self.deviceMotionLastEventTimestamp=currentTime;if(windowDispatchAvailable){window.dispatchEvent(evt)}else{document.dispatchEvent(evt)}};var accelFail=function(){};window.addEventListener=function(){if(arguments[0]===devicemotionEvent){++(self.deviceMotionListenerCount);if(self.deviceMotionListenerCount==1){self.deviceMotionWatchId=navigator.accelerometer.watchAcceleration(accelWin,accelFail,{frequency:500})}}if(!windowDispatchAvailable){return document.addEventListener.apply(this,arguments)}else{return _addEventListener.apply(this,arguments)}};window.removeEventListener=function(){if(arguments[0]===devicemotionEvent){--(self.deviceMotionListenerCount);if(self.deviceMotionListenerCount==0){navigator.accelerometer.clearWatch(self.deviceMotionWatchId)}}if(!windowDispatchAvailable){return document.removeEventListener.apply(this,arguments)}else{return _removeEventListener.apply(this,arguments)}}};PhoneGap.addConstructor(Accelerometer.install);PhoneGap.addConstructor(Accelerometer.installDeviceMotionHandler)}if(!PhoneGap.hasResource("camera")){PhoneGap.addResource("camera");Camera=function(){};Camera.DestinationType={DATA_URL:0,FILE_URI:1};Camera.prototype.DestinationType=Camera.DestinationType;Camera.PictureSourceType={PHOTOLIBRARY:0,CAMERA:1,SAVEDPHOTOALBUM:2};Camera.prototype.PictureSourceType=Camera.PictureSourceType;Camera.prototype.getPicture=function(successCallback,errorCallback,options){console.warn("Camera.getPicture is deprecated and will be removed in 1.0, and put in the plugins repo. Plese use the Media Capture API instead.");if(typeof successCallback!="function"){console.log("Camera Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!="function")){console.log("Camera Error: errorCallback is not a function");return}PhoneGap.exec(successCallback,errorCallback,"Camera","getPicture",[options])};PhoneGap.addConstructor(function(){if(typeof navigator.camera=="undefined"){navigator.camera=new Camera()}})}if(!PhoneGap.hasResource("capture")){PhoneGap.addResource("capture");function CaptureError(){this.code=null}CaptureError.CAPTURE_INTERNAL_ERR=0;CaptureError.CAPTURE_APPLICATION_BUSY=1;CaptureError.CAPTURE_INVALID_ARGUMENT=2;CaptureError.CAPTURE_NO_MEDIA_FILES=3;CaptureError.CAPTURE_NOT_SUPPORTED=20;function Capture(){this.supportedAudioModes=[];this.supportedImageModes=[];this.supportedVideoModes=[]}Capture.prototype.captureAudio=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"Capture","captureAudio",[options])};Capture.prototype.captureImage=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"Capture","captureImage",[options])};Capture.prototype._castMediaFile=function(pluginResult){var mediaFiles=[];var i;for(i=0;i<pluginResult.message.length;i++){var mediaFile=new MediaFile();mediaFile.name=pluginResult.message[i].name;mediaFile.fullPath=pluginResult.message[i].fullPath;mediaFile.type=pluginResult.message[i].type;mediaFile.lastModifiedDate=pluginResult.message[i].lastModifiedDate;mediaFile.size=pluginResult.message[i].size;mediaFiles.push(mediaFile)}pluginResult.message=mediaFiles;return pluginResult};Capture.prototype.captureVideo=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"Capture","captureVideo",[options])};function ConfigurationData(){this.type;this.height=0;this.width=0}var CaptureImageOptions=function(){this.limit=1;this.mode=null};var CaptureVideoOptions=function(){this.limit=1;this.duration=0;this.mode=null};var CaptureAudioOptions=function(){this.limit=1;this.duration=0;this.mode=null};function MediaFile(name,fullPath,type,lastModifiedDate,size){this.name=name||null;this.fullPath=fullPath||null;this.type=type||null;this.lastModifiedDate=lastModifiedDate||null;this.size=size||0}MediaFile.prototype.getFormatData=function(successCallback,errorCallback){if(typeof this.fullPath==="undefined"||this.fullPath===null){errorCallback({code:CaptureError.CAPTURE_INVALID_ARGUMENT})}else{PhoneGap.exec(successCallback,errorCallback,"Capture","getFormatData",[this.fullPath,this.type])}};function MediaFileData(codecs,bitrate,height,width,duration){this.codecs=codecs||null;this.bitrate=bitrate||0;this.height=height||0;this.width=width||0;this.duration=duration||0}PhoneGap.addConstructor(function(){if(typeof navigator.device==="undefined"){navigator.device=window.device=new Device()}if(typeof navigator.device.capture==="undefined"){navigator.device.capture=window.device.capture=new Capture()}})}if(!PhoneGap.hasResource("contact")){PhoneGap.addResource("contact");var Contact=function(id,displayName,name,nickname,phoneNumbers,emails,addresses,ims,organizations,revision,birthday,gender,note,photos,categories,urls,timezone){this.id=id||null;this.displayName=displayName||null;this.name=name||null;this.nickname=nickname||null;this.phoneNumbers=phoneNumbers||null;this.emails=emails||null;this.addresses=addresses||null;this.ims=ims||null;this.organizations=organizations||null;this.revision=revision||null;this.birthday=birthday||null;this.gender=gender||null;this.note=note||null;this.photos=photos||null;this.categories=categories||null;this.urls=urls||null;this.timezone=timezone||null};Contact.prototype.convertDatesOut=function(){var dates=new Array("revision","birthday");for(var i=0;i<dates.length;i++){var value=this[dates[i]];if(value){if(!value instanceof Date){try{value=new Date(value)}catch(exception){value=null}}if(value instanceof Date){value=value.valueOf()}this[dates[i]]=value}}};Contact.prototype.convertDatesIn=function(){var dates=new Array("revision","birthday");for(var i=0;i<dates.length;i++){var value=this[dates[i]];if(value){try{this[dates[i]]=new Date(parseFloat(value))}catch(exception){console.log("exception creating date")}}}};Contact.prototype.remove=function(successCB,errorCB){if(this.id==null){var errorObj=new ContactError();errorObj.code=ContactError.NOT_FOUND_ERROR;errorCB(errorObj)}else{PhoneGap.exec(successCB,errorCB,"Contacts","remove",[{contact:this}])}};Contact.prototype.display=function(successCB,errorCB,options){if(this.id==null){var errorObj=new ContactError();errorObj.code=ContactError.NOT_FOUND_ERROR;errorCB(errorObj)}else{PhoneGap.exec(successCB,errorCB,"Contacts","displayContact",[this.id,options])}};Contact.prototype.clone=function(){var clonedContact=PhoneGap.clone(this);clonedContact.id=null;if(clonedContact.phoneNumbers){for(i=0;i<clonedContact.phoneNumbers.length;i++){clonedContact.phoneNumbers[i].id=null}}if(clonedContact.emails){for(i=0;i<clonedContact.emails.length;i++){clonedContact.emails[i].id=null}}if(clonedContact.addresses){for(i=0;i<clonedContact.addresses.length;i++){clonedContact.addresses[i].id=null}}if(clonedContact.ims){for(i=0;i<clonedContact.ims.length;i++){clonedContact.ims[i].id=null}}if(clonedContact.organizations){for(i=0;i<clonedContact.organizations.length;i++){clonedContact.organizations[i].id=null}}if(clonedContact.photos){for(i=0;i<clonedContact.photos.length;i++){clonedContact.photos[i].id=null}}if(clonedContact.urls){for(i=0;i<clonedContact.urls.length;i++){clonedContact.urls[i].id=null}}return clonedContact};Contact.prototype.save=function(successCB,errorCB){var cloned=PhoneGap.clone(this);cloned.convertDatesOut();PhoneGap.exec(successCB,errorCB,"Contacts","save",[{contact:cloned}])};var ContactName=function(formatted,familyName,givenName,middle,prefix,suffix){this.formatted=formatted!="undefined"?formatted:null;this.familyName=familyName!="undefined"?familyName:null;this.givenName=givenName!="undefined"?givenName:null;this.middleName=middle!="undefined"?middle:null;this.honorificPrefix=prefix!="undefined"?prefix:null;this.honorificSuffix=suffix!="undefined"?suffix:null};var ContactField=function(type,value,pref,id){this.type=type!="undefined"?type:null;this.value=value!="undefined"?value:null;this.pref=pref!="undefined"?pref:null;this.id=id!="undefined"?id:null};var ContactAddress=function(formatted,streetAddress,locality,region,postalCode,country,id){this.formatted=formatted!="undefined"?formatted:null;this.streetAddress=streetAddress!="undefined"?streetAddress:null;this.locality=locality!="undefined"?locality:null;this.region=region!="undefined"?region:null;this.postalCode=postalCode!="undefined"?postalCode:null;this.country=country!="undefined"?country:null;this.id=id!="undefined"?id:null};var ContactOrganization=function(name,dept,title,startDate,endDate,location,desc){this.name=name!="undefined"?name:null;this.department=dept!="undefined"?dept:null;this.title=title!="undefined"?title:null;this.startDate=startDate!="undefined"?startDate:null;this.endDate=endDate!="undefined"?endDate:null;this.location=location!="undefined"?location:null;this.description=desc!="undefined"?desc:null};var ContactAccount=function(domain,username,userid){this.domain=domain!="undefined"?domain:null;this.username=username!="undefined"?username:null;this.userid=userid!="undefined"?userid:null};var Contacts=function(){this.inProgress=false;this.records=new Array();this.resultsCallback=null;this.errorCallback=null};Contacts.prototype.find=function(fields,successCB,errorCB,options){var theOptions=options||null;if(theOptions!=null){var value=theOptions.updatedSince;if(value!=""){if(!value instanceof Date){try{value=new Date(value)}catch(exception){value=null}}if(value instanceof Date){theOptions.updatedSince=value.valueOf()}}}PhoneGap.exec(successCB,errorCB,"Contacts","search",[{fields:fields,findOptions:theOptions}])};Contacts.prototype._findCallback=function(pluginResult){var contacts=new Array();try{for(var i=0;i<pluginResult.message.length;i++){var newContact=navigator.service.contacts.create(pluginResult.message[i]);newContact.convertDatesIn();contacts.push(newContact)}pluginResult.message=contacts}catch(e){console.log("Error parsing contacts: "+e)}return pluginResult};Contacts.prototype._contactCallback=function(pluginResult){var newContact=null;if(pluginResult.message){try{newContact=navigator.service.contacts.create(pluginResult.message);newContact.convertDatesIn()}catch(e){console.log("Error parsing contact")}}pluginResult.message=newContact;return pluginResult};Contacts.prototype._errCallback=function(pluginResult){var errorObj=new ContactError();errorObj.code=pluginResult.message;pluginResult.message=errorObj;return pluginResult};Contacts.prototype.newContactUI=function(successCallback){PhoneGap.exec(successCallback,null,"Contacts","newContact",[])};Contacts.prototype.chooseContact=function(successCallback,options){PhoneGap.exec(successCallback,null,"Contacts","chooseContact",options)};Contacts.prototype.create=function(properties){var contact=new Contact();for(i in properties){if(contact[i]!="undefined"){contact[i]=properties[i]}}return contact};var ContactFindOptions=function(filter,multiple,updatedSince){this.filter=filter||"";this.multiple=multiple||true;this.updatedSince=updatedSince||""};var ContactError=function(){this.code=null};ContactError.UNKNOWN_ERROR=0;ContactError.INVALID_ARGUMENT_ERROR=1;ContactError.NOT_FOUND_ERROR=2;ContactError.TIMEOUT_ERROR=3;ContactError.PENDING_OPERATION_ERROR=4;ContactError.IO_ERROR=5;ContactError.NOT_SUPPORTED_ERROR=6;ContactError.PERMISSION_DENIED_ERROR=20;PhoneGap.addConstructor(function(){if(typeof navigator.service=="undefined"){navigator.service=new Object()}if(typeof navigator.service.contacts=="undefined"){navigator.service.contacts=new Contacts()}})}if(!PhoneGap.hasResource("device")){PhoneGap.addResource("device");Device=function(){this.platform=null;this.version=null;this.name=null;this.phonegap=null;this.uuid=null;try{this.platform=DeviceInfo.platform;this.version=DeviceInfo.version;this.name=DeviceInfo.name;this.phonegap=DeviceInfo.gap;this.uuid=DeviceInfo.uuid}catch(e){}this.available=PhoneGap.available=this.uuid!=null};PhoneGap.addConstructor(function(){if(typeof navigator.device==="undefined"){navigator.device=window.device=new Device()}})}if(!PhoneGap.hasResource("file")){PhoneGap.addResource("file");FileProperties=function(filePath){this.filePath=filePath;this.size=0;this.lastModifiedDate=null};File=function(name,fullPath,type,lastModifiedDate,size){this.name=name||null;this.fullPath=fullPath||null;this.type=type||null;this.lastModifiedDate=lastModifiedDate||null;this.size=size||0};File._createEvent=function(type,target){var evt={type:type};evt.target=target;return evt};FileError=function(){this.code=null};FileError.NOT_FOUND_ERR=1;FileError.SECURITY_ERR=2;FileError.ABORT_ERR=3;FileError.NOT_READABLE_ERR=4;FileError.ENCODING_ERR=5;FileError.NO_MODIFICATION_ALLOWED_ERR=6;FileError.INVALID_STATE_ERR=7;FileError.SYNTAX_ERR=8;FileError.INVALID_MODIFICATION_ERR=9;FileError.QUOTA_EXCEEDED_ERR=10;FileError.TYPE_MISMATCH_ERR=11;FileError.PATH_EXISTS_ERR=12;FileMgr=function(){};FileMgr.prototype.testFileExists=function(fileName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","testFileExists",[fileName])};FileMgr.prototype.testDirectoryExists=function(dirName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","testDirectoryExists",[dirName])};FileMgr.prototype.getFreeDiskSpace=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getFreeDiskSpace",[])};FileMgr.prototype.writeAsText=function(fileName,data,bAppend,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","write",[fileName,data,bAppend?1:0])};FileMgr.prototype.write=function(fileName,data,position,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","write",[fileName,data,position])};FileMgr.prototype.truncate=function(fileName,size,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","truncateFile",[fileName,size])};FileMgr.prototype.readAsText=function(fileName,encoding,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","readFile",[fileName,encoding])};FileMgr.prototype.readAsDataURL=function(fileName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","readAsDataURL",[fileName])};PhoneGap.addConstructor(function(){if(typeof navigator.fileMgr==="undefined"){navigator.fileMgr=new FileMgr()}});FileReader=function(){this.fileName="";this.readyState=0;this.result=null;this.error=null;this.onloadstart=null;this.onprogress=null;this.onload=null;this.onerror=null;this.onloadend=null;this.onabort=null};FileReader.EMPTY=0;FileReader.LOADING=1;FileReader.DONE=2;FileReader.prototype.abort=function(){var evt;this.readyState=FileReader.DONE;this.result=null;var error=new FileError();error.code=error.ABORT_ERR;this.error=error;if(typeof this.onerror==="function"){evt=File._createEvent("error",this);this.onerror(evt)}if(typeof this.onabort==="function"){evt=File._createEvent("abort",this);this.onabort(evt)}if(typeof this.onloadend==="function"){evt=File._createEvent("loadend",this);this.onloadend(evt)}};FileReader.prototype.readAsText=function(file,encoding){this.fileName="";if(typeof file.fullPath==="undefined"){this.fileName=file}else{this.fileName=file.fullPath}this.readyState=FileReader.LOADING;if(typeof this.onloadstart==="function"){var evt=File._createEvent("loadstart",this);this.onloadstart(evt)}var enc=encoding?encoding:"UTF-8";var me=this;navigator.fileMgr.readAsText(this.fileName,enc,function(r){var evt;if(me.readyState===FileReader.DONE){return}me.result=decodeURIComponent(r);if(typeof me.onload==="function"){evt=File._createEvent("load",me);me.onload(evt)}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){evt=File._createEvent("loadend",me);me.onloadend(evt)}},function(e){var evt;if(me.readyState===FileReader.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){evt=File._createEvent("loadend",me);me.onloadend(evt)}})};FileReader.prototype.readAsDataURL=function(file){this.fileName="";if(typeof file.fullPath==="undefined"){this.fileName=file}else{this.fileName=file.fullPath}this.readyState=FileReader.LOADING;if(typeof this.onloadstart==="function"){var evt=File._createEvent("loadstart",this);this.onloadstart(evt)}var me=this;navigator.fileMgr.readAsDataURL(this.fileName,function(r){var evt;if(me.readyState===FileReader.DONE){return}me.result=r;if(typeof me.onload==="function"){evt=File._createEvent("load",me);me.onload(evt)}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){evt=File._createEvent("loadend",me);me.onloadend(evt)}},function(e){var evt;if(me.readyState===FileReader.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){evt=File._createEvent("loadend",me);me.onloadend(evt)}})};FileReader.prototype.readAsBinaryString=function(file){this.fileName=file};FileReader.prototype.readAsArrayBuffer=function(file){this.fileName=file};FileWriter=function(file){this.fileName="";this.length=0;if(file){this.fileName=file.fullPath||file;this.length=file.size||0}this.position=0;this.readyState=0;this.result=null;this.error=null;this.onwritestart=null;this.onprogress=null;this.onwrite=null;this.onwriteend=null;this.onabort=null;this.onerror=null};FileWriter.INIT=0;FileWriter.WRITING=1;FileWriter.DONE=2;FileWriter.prototype.abort=function(){if(this.readyState===FileWriter.DONE||this.readyState===FileWriter.INIT){throw FileError.INVALID_STATE_ERR}var error=new FileError(),evt;error.code=error.ABORT_ERR;this.error=error;if(typeof this.onerror==="function"){evt=File._createEvent("error",this);this.onerror(evt)}if(typeof this.onabort==="function"){evt=File._createEvent("abort",this);this.onabort(evt)}this.readyState=FileWriter.DONE;if(typeof this.onwriteend=="function"){evt=File._createEvent("writeend",this);this.onwriteend(evt)}};FileWriter.prototype.writeAsText=function(file,text,bAppend){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}if(bAppend!==true){bAppend=false}this.fileName=file;this.readyState=FileWriter.WRITING;var me=this;if(typeof me.onwritestart==="function"){var evt=File._createEvent("writestart",me);me.onwritestart(evt)}navigator.fileMgr.writeAsText(file,text,bAppend,function(r){var evt;if(me.readyState===FileWriter.DONE){return}me.result=r;if(typeof me.onwrite==="function"){evt=File._createEvent("write",me);me.onwrite(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}},function(e){var evt;if(me.readyState===FileWriter.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}})};FileWriter.prototype.write=function(text){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}this.readyState=FileWriter.WRITING;var me=this;if(typeof me.onwritestart==="function"){var evt=File._createEvent("writestart",me);me.onwritestart(evt)}navigator.fileMgr.write(this.fileName,text,this.position,function(r){var evt;if(me.readyState===FileWriter.DONE){return}me.position+=r;me.length=me.position;if(typeof me.onwrite==="function"){evt=File._createEvent("write",me);me.onwrite(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}},function(e){var evt;if(me.readyState===FileWriter.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}})};FileWriter.prototype.seek=function(offset){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}if(!offset){return}if(offset<0){this.position=Math.max(offset+this.length,0)}else{if(offset>this.length){this.position=this.length}else{this.position=offset}}};FileWriter.prototype.truncate=function(size){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}this.readyState=FileWriter.WRITING;var me=this;if(typeof me.onwritestart==="function"){var evt=File._createEvent("writestart",me);me.onwritestart(evt)}navigator.fileMgr.truncate(this.fileName,size,function(r){var evt;if(me.readyState===FileWriter.DONE){return}me.length=r;me.position=Math.min(me.position,r);if(typeof me.onwrite==="function"){evt=File._createEvent("write",me);me.onwrite(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}},function(e){var evt;if(me.readyState===FileWriter.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}})};LocalFileSystem=function(){};LocalFileSystem.TEMPORARY=0;LocalFileSystem.PERSISTENT=1;LocalFileSystem.RESOURCE=2;LocalFileSystem.APPLICATION=3;LocalFileSystem.prototype.requestFileSystem=function(type,size,successCallback,errorCallback){if(type<0||type>3){if(typeof errorCallback=="function"){errorCallback({code:FileError.SYNTAX_ERR})}}else{PhoneGap.exec(successCallback,errorCallback,"File","requestFileSystem",[type,size])}};LocalFileSystem.prototype.resolveLocalFileSystemURI=function(uri,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","resolveLocalFileSystemURI",[uri])};LocalFileSystem.prototype._castFS=function(pluginResult){var entry=null;entry=new DirectoryEntry();entry.isDirectory=pluginResult.message.root.isDirectory;entry.isFile=pluginResult.message.root.isFile;entry.name=pluginResult.message.root.name;entry.fullPath=pluginResult.message.root.fullPath;pluginResult.message.root=entry;return pluginResult};LocalFileSystem.prototype._castEntry=function(pluginResult){var entry=null;if(pluginResult.message.isDirectory){entry=new DirectoryEntry()}else{if(pluginResult.message.isFile){entry=new FileEntry()}}entry.isDirectory=pluginResult.message.isDirectory;entry.isFile=pluginResult.message.isFile;entry.name=pluginResult.message.name;entry.fullPath=pluginResult.message.fullPath;pluginResult.message=entry;return pluginResult};LocalFileSystem.prototype._castEntries=function(pluginResult){var entries=pluginResult.message;var retVal=[];for(i=0;i<entries.length;i++){retVal.push(window.localFileSystem._createEntry(entries[i]))}pluginResult.message=retVal;return pluginResult};LocalFileSystem.prototype._createEntry=function(castMe){var entry=null;if(castMe.isDirectory){entry=new DirectoryEntry()}else{if(castMe.isFile){entry=new FileEntry()}}entry.isDirectory=castMe.isDirectory;entry.isFile=castMe.isFile;entry.name=castMe.name;entry.fullPath=castMe.fullPath;return entry};LocalFileSystem.prototype._castDate=function(pluginResult){if(pluginResult.message.modificationTime){var metadataObj=new Metadata();metadataObj.modificationTime=new Date(pluginResult.message.modificationTime);pluginResult.message=metadataObj}else{if(pluginResult.message.lastModifiedDate){var file=new File();file.size=pluginResult.message.size;file.type=pluginResult.message.type;file.name=pluginResult.message.name;file.fullPath=pluginResult.message.fullPath;file.lastModifiedDate=new Date(pluginResult.message.lastModifiedDate);pluginResult.message=file}}return pluginResult};LocalFileSystem.prototype._castError=function(pluginResult){var fileError=new FileError();fileError.code=pluginResult.message;pluginResult.message=fileError;return pluginResult};Metadata=function(){this.modificationTime=null};Flags=function(create,exclusive){this.create=create||false;this.exclusive=exclusive||false};FileSystem=function(){this.name=null;this.root=null};DirectoryEntry=function(){this.isFile=false;this.isDirectory=true;this.name=null;this.fullPath=null;this.filesystem=null};DirectoryEntry.prototype.copyTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","copyTo",[this.fullPath,parent,newName])};DirectoryEntry.prototype.getMetadata=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getMetadata",[this.fullPath])};DirectoryEntry.prototype.getParent=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getParent",[this.fullPath])};DirectoryEntry.prototype.moveTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","moveTo",[this.fullPath,parent,newName])};DirectoryEntry.prototype.remove=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","remove",[this.fullPath])};DirectoryEntry.prototype.toURI=function(mimeType,successCallback,errorCallback){return"file://localhost"+this.fullPath};DirectoryEntry.prototype.createReader=function(successCallback,errorCallback){return new DirectoryReader(this.fullPath)};DirectoryEntry.prototype.getDirectory=function(path,options,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getDirectory",[this.fullPath,path,options])};DirectoryEntry.prototype.getFile=function(path,options,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getFile",[this.fullPath,path,options])};DirectoryEntry.prototype.removeRecursively=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","removeRecursively",[this.fullPath])};DirectoryReader=function(fullPath){this.fullPath=fullPath||null};DirectoryReader.prototype.readEntries=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","readEntries",[this.fullPath])};FileEntry=function(){this.isFile=true;this.isDirectory=false;this.name=null;this.fullPath=null;this.filesystem=null};FileEntry.prototype.copyTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","copyTo",[this.fullPath,parent,newName])};FileEntry.prototype.getMetadata=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getMetadata",[this.fullPath])};FileEntry.prototype.getParent=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getParent",[this.fullPath])};FileEntry.prototype.moveTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","moveTo",[this.fullPath,parent,newName])};FileEntry.prototype.remove=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","remove",[this.fullPath])};FileEntry.prototype.toURI=function(mimeType,successCallback,errorCallback){return"file://localhost"+this.fullPath};FileEntry.prototype.createWriter=function(successCallback,errorCallback){this.file(function(filePointer){var writer=new FileWriter(filePointer);if(writer.fileName==null||writer.fileName==""){if(typeof errorCallback=="function"){errorCallback({code:FileError.INVALID_STATE_ERR})}}if(typeof successCallback=="function"){successCallback(writer)}},errorCallback)};FileEntry.prototype.file=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"File","getFileMetadata",[this.fullPath])};PhoneGap.addConstructor(function(){var pgLocalFileSystem=new LocalFileSystem();if(typeof window.localFileSystem=="undefined"){window.localFileSystem=pgLocalFileSystem}if(typeof window.requestFileSystem=="undefined"){window.requestFileSystem=pgLocalFileSystem.requestFileSystem}if(typeof window.resolveLocalFileSystemURI=="undefined"){window.resolveLocalFileSystemURI=pgLocalFileSystem.resolveLocalFileSystemURI}})}if(!PhoneGap.hasResource("filetransfer")){PhoneGap.addResource("filetransfer");FileTransfer=function(){};FileUploadResult=function(){this.bytesSent=0;this.responseCode=null;this.response=null};FileTransferError=function(errorCode){this.code=errorCode||null};FileTransferError.FILE_NOT_FOUND_ERR=1;FileTransferError.INVALID_URL_ERR=2;FileTransferError.CONNECTION_ERR=3;FileTransfer.prototype.upload=function(filePath,server,successCallback,errorCallback,options){if(!options.params){options.params={}}options.filePath=filePath;options.server=server;if(!options.fileKey){options.fileKey="file"}if(!options.fileName){options.fileName="image.jpg"}if(!options.mimeType){options.mimeType="image/jpeg"}if(typeof successCallback!="function"){console.log("FileTransfer Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!="function")){console.log("FileTransfer Error: errorCallback is not a function");return}PhoneGap.exec(successCallback,errorCallback,"FileTransfer","upload",[options])};FileTransfer.prototype._castTransferError=function(pluginResult){var fileError=new FileTransferError(pluginResult.message);pluginResult.message=fileError;return pluginResult};FileTransfer.prototype._castUploadResult=function(pluginResult){var result=new FileUploadResult();result.bytesSent=pluginResult.message.bytesSent;result.responseCode=pluginResult.message.responseCode;result.response=decodeURIComponent(pluginResult.message.response);pluginResult.message=result;return pluginResult};FileUploadOptions=function(fileKey,fileName,mimeType,params){this.fileKey=fileKey||null;this.fileName=fileName||null;this.mimeType=mimeType||null;this.params=params||null};PhoneGap.addConstructor(function(){if(typeof navigator.fileTransfer=="undefined"){navigator.fileTransfer=new FileTransfer()}})}if(!PhoneGap.hasResource("geolocation")){PhoneGap.addResource("geolocation");Geolocation=function(){this.lastPosition=null;this.listener=null;this.timeoutTimerId=0};Geolocation.prototype.getCurrentPosition=function(successCallback,errorCallback,options){var win=successCallback;if(!win||typeof(win)!="function"){win=function(position){}}var fail=errorCallback;if(!fail||typeof(fail)!="function"){fail=function(positionError){}}var self=this;var totalTime=0;var timeoutTimerId;var params=new PositionOptions();if(options){if(options.maximumAge){if(this.lastPosition){var now=new Date().getTime();if(now-this.lastPosition.timestamp<options.maximumAge){win(this.lastPosition);return}}params.maximumAge=options.maximumAge}if(options.enableHighAccuracy){params.enableHighAccuracy=(options.enableHighAccuracy==true)}if(options.timeout){params.timeout=options.timeout}}this.listener={success:win,fail:fail};this.start(params);var onTimeout=function(){self.setError(new PositionError(PositionError.TIMEOUT,"Geolocation Error: Timeout."))};this.timeoutTimerId=setTimeout(onTimeout,params.timeout)};Geolocation.prototype.watchPosition=function(successCallback,errorCallback,options){var self=this;var params=new PositionOptions();if(options){if(options.maximumAge){params.maximumAge=options.maximumAge}if(options.enableHighAccuracy){params.enableHighAccuracy=options.enableHighAccuracy}if(options.timeout){params.timeout=options.timeout}}var that=this;var lastPos=that.lastPosition?that.lastPosition.clone():null;return setInterval(function(){var filterFun=function(position){if(lastPos==null||!position.equals(lastPos)){successCallback(position)}lastPos=position.clone()};that.getCurrentPosition(filterFun,errorCallback,params)},params.timeout)};Geolocation.prototype.clearWatch=function(watchId){clearInterval(watchId)};Geolocation.prototype.setLocation=function(position){var _position=new Position(position.coords,position.timestamp);if(this.timeoutTimerId){clearTimeout(this.timeoutTimerId);this.timeoutTimerId=0}this.lastError=null;this.lastPosition=_position;if(this.listener&&typeof(this.listener.success)=="function"){this.listener.success(_position)}this.listener=null};Geolocation.prototype.setError=function(error){var _error=new PositionError(error.code,error.message);if(this.timeoutTimerId){clearTimeout(this.timeoutTimerId);this.timeoutTimerId=0}this.lastError=_error;if(this.listener&&typeof(this.listener.fail)=="function"){this.listener.fail(_error)}this.listener=null};Geolocation.prototype.start=function(args){PhoneGap.exec("Location.startLocation",args)};Geolocation.prototype.stop=function(){PhoneGap.exec("Location.stopLocation")};PhoneGap.addConstructor(function(){if(typeof navigator._geo=="undefined"){var __proxyObj=function(origObj,proxyObj,funkList){var replaceFunk=function(org,proxy,fName){org[fName]=function(){return proxy[fName].apply(proxy,arguments)}};for(var v in funkList){replaceFunk(origObj,proxyObj,funkList[v])}};navigator._geo=new Geolocation();__proxyObj(navigator.geolocation,navigator._geo,["setLocation","getCurrentPosition","watchPosition","clearWatch","setError","start","stop"])}})}if(!PhoneGap.hasResource("compass")){PhoneGap.addResource("compass");Compass=function(){this.lastHeading=null;this.lastError=null;this.callbacks={onHeadingChanged:[],onError:[]}};Compass.prototype.getCurrentHeading=function(successCallback,errorCallback,options){if(this.lastHeading==null){this.callbacks.onHeadingChanged.push(successCallback);this.callbacks.onError.push(errorCallback);this.start(options)}else{if(options.maximumAge){var now=new Date().getTime();if(now-this.lastHeading.timestamp>options.maximumAge){this.callbacks.onHeadingChanged.push(successCallback);this.callbacks.onError.push(errorCallback);this.start(options);return}}if(typeof successCallback=="function"){var returnHeading=-1;if(this.lastHeading.trueHeading>-1){returnHeading=this.lastHeading.trueHeading}else{if(this.lastHeading.magneticHeading){returnHeading=this.lastHeading.magneticHeading}}successCallback(returnHeading)}}};Compass.prototype.watchHeading=function(successCallback,errorCallback,options){var frequency=(options&&options.frequency)?options.frequency:1000;var self=this;var funk=function(){self.getCurrentHeading(successCallback,errorCallback,options)};funk();return setInterval(funk,frequency)};Compass.prototype.clearWatch=function(watchId){clearInterval(watchId)};Compass.prototype.setHeading=function(heading){this.lastHeading=heading;var returnHeading=-1;if(this.lastHeading.trueHeading>-1){returnHeading=this.lastHeading.trueHeading}else{if(this.lastHeading.magneticHeading){returnHeading=this.lastHeading.magneticHeading}}var arr=this.callbacks.onHeadingChanged;for(var i=0,len=arr.length;i<len;i++){arr[i](returnHeading)}this.callbacks.onHeadingChanged=[];this.callbacks.onError=[]};Compass.prototype.setError=function(message){this.lastError=message;var arr=this.callbacks.onError;for(var i=0,len=arr.length;i<len;i++){arr[i](message)}this.callbacks.onHeadingChanged=[];this.callbacks.onError=[];this.stop()};Compass.prototype.start=function(args){PhoneGap.exec("Location.startHeading",args)};Compass.prototype.stop=function(){PhoneGap.exec("Location.stopHeading")};PhoneGap.addConstructor(function(){if(typeof navigator.compass=="undefined"){navigator.compass=new Compass()}})}if(!PhoneGap.hasResource("media")){PhoneGap.addResource("media");Media=function(src,successCallback,errorCallback,downloadCompleteCallback){if(!src){src="documents://"+String((new Date()).getTime()).replace(/\D/gi,"")}this.src=src;var successCB=(successCallback==undefined||successCallback==null)?null:GetFunctionName(successCallback);var errorCB=(errorCallback==undefined||errorCallback==null)?null:GetFunctionName(errorCallback);var downloadCB=(downloadCompleteCallback==undefined||downloadCompleteCallback==null)?null:GetFunctionName(downloadCompleteCallback);this.successCallback=successCallback||null;this.errorCallback=errorCallback||null;this.downloadCompleteCallback=downloadCompleteCallback||null;if(this.src!=null){PhoneGap.exec("Sound.prepare",this.src,successCB,errorCB,downloadCB)}};Media.prototype.play=function(options){if(this.src!=null){PhoneGap.exec("Sound.play",this.src,options)}};Media.prototype.pause=function(){if(this.src!=null){PhoneGap.exec("Sound.pause",this.src)}};Media.prototype.stop=function(){if(this.src!=null){PhoneGap.exec("Sound.stop",this.src)}};Media.prototype.startAudioRecord=function(options){if(this.src!=null){PhoneGap.exec("Sound.startAudioRecord",this.src,options)}};Media.prototype.stopAudioRecord=function(){if(this.src!=null){PhoneGap.exec("Sound.stopAudioRecord",this.src)}};MediaError=function(){this.code=null,this.message=""};MediaError.MEDIA_ERR_ABORTED=1;MediaError.MEDIA_ERR_NETWORK=2;MediaError.MEDIA_ERR_DECODE=3;MediaError.MEDIA_ERR_NONE_SUPPORTED=4}if(!PhoneGap.hasResource("notification")){PhoneGap.addResource("notification");Notification=function(){};Notification.prototype.alert=function(message,completeCallback,title,buttonLabel){var _title=(title||"Alert");var _buttonLabel=(buttonLabel||"OK");PhoneGap.exec(completeCallback,null,"Notification","alert",[message,{title:_title,buttonLabel:_buttonLabel}])};Notification.prototype.confirm=function(message,resultCallback,title,buttonLabels){var _title=(title||"Confirm");var _buttonLabels=(buttonLabels||"OK,Cancel");this.alert(message,resultCallback,_title,_buttonLabels)};Notification.prototype.activityStart=function(){console.warn("Notification.activityStart is deprecated and will be removed in 1.0. It will be moved to the plugins repo.");PhoneGap.exec(null,null,"Notification","activityStart",[])};Notification.prototype.activityStop=function(){console.warn("Notification.activityStop is deprecated and will be removed in 1.0. It will be moved to the plugins repo.");PhoneGap.exec(null,null,"Notification","activityStop",[])};Notification.prototype.loadingStart=function(options){console.warn("Notification.loadingStart is deprecated and will be removed in 1.0. It will be moved to the plugins repo.");PhoneGap.exec(null,null,"Notification","loadingStart",[options])};Notification.prototype.loadingStop=function(){console.warn("Notification.loadingStop is deprecated and will be removed in 1.0. It will be moved to the plugins repo.");PhoneGap.exec(null,null,"Notification","loadingStop",[])};Notification.prototype.blink=function(count,colour){};Notification.prototype.vibrate=function(mills){PhoneGap.exec(null,null,"Notification","vibrate",[])};Notification.prototype.beep=function(count,volume){new Media("beep.wav").play()};PhoneGap.addConstructor(function(){if(typeof navigator.notification=="undefined"){navigator.notification=new Notification()}})}if(!PhoneGap.hasResource("orientation")){PhoneGap.addResource("orientation");Orientation=function(){this.currentOrientation=null};Orientation.prototype.setOrientation=function(orientation){Orientation.currentOrientation=orientation;var e=document.createEvent("Events");e.initEvent("orientationChanged","false","false");e.orientation=orientation;document.dispatchEvent(e)};Orientation.prototype.getCurrentOrientation=function(successCallback,errorCallback){};Orientation.prototype.watchOrientation=function(successCallback,errorCallback){this.getCurrentPosition(successCallback,errorCallback);return setInterval(function(){navigator.orientation.getCurrentOrientation(successCallback,errorCallback)},10000)};Orientation.prototype.clearWatch=function(watchId){clearInterval(watchId)};Orientation.install=function(){if(typeof navigator.orientation=="undefined"){navigator.orientation=new Orientation()}var windowDispatchAvailable=!(window.dispatchEvent===undefined);if(windowDispatchAvailable){return}var self=this;var orientationchangeEvent="orientationchange";var newOrientationchangeEvent="orientationchange_pg";var _addEventListener=window.addEventListener;var _removeEventListener=window.removeEventListener;window.onorientationchange=function(){PhoneGap.fireEvent(newOrientationchangeEvent,window)};window.addEventListener=function(){if(arguments[0]===orientationchangeEvent){arguments[0]=newOrientationchangeEvent}if(!windowDispatchAvailable){return document.addEventListener.apply(this,arguments)}else{return _addEventListener.apply(this,arguments)}};window.removeEventListener=function(){if(arguments[0]===orientationchangeEvent){arguments[0]=newOrientationchangeEvent}if(!windowDispatchAvailable){return document.removeEventListener.apply(this,arguments)}else{return _removeEventListener.apply(this,arguments)}}};PhoneGap.addConstructor(Orientation.install)}if(!PhoneGap.hasResource("sms")){PhoneGap.addResource("sms");Sms=function(){};Sms.prototype.send=function(number,message,successCallback,errorCallback,options){};PhoneGap.addConstructor(function(){if(typeof navigator.sms=="undefined"){navigator.sms=new Sms()}})}if(!PhoneGap.hasResource("telephony")){PhoneGap.addResource("telephony");Telephony=function(){};Telephony.prototype.call=function(number){};PhoneGap.addConstructor(function(){if(typeof navigator.telephony=="undefined"){navigator.telephony=new Telephony()}})}if(!PhoneGap.hasResource("network")){PhoneGap.addResource("network");Connection=function(){this.type=Connection.UNKNOWN;try{this.type=DeviceInfo.connection.type}catch(e){}};Connection.UNKNOWN="unknown";Connection.ETHERNET="ethernet";Connection.WIFI="wifi";Connection.CELL_2G="2g";Connection.CELL_3G="3g";Connection.CELL_4G="4g";Connection.NONE="none";NetworkStatus=function(){this.code=null;this.message=""};NetworkStatus.NOT_REACHABLE=0;NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK=1;NetworkStatus.REACHABLE_VIA_WIFI_NETWORK=2;Network=function(){};Network.prototype.isReachable=function(hostName,successCallback,options){console.warn("Network.isReachable is deprecated and will be removed in 1.0. Please use the Network Information API instead.");PhoneGap.exec("Network.isReachable",hostName,GetFunctionName(successCallback),options)};PhoneGap.addConstructor(function(){if(typeof navigator.network=="undefined"){navigator.network=new Network()}if(typeof navigator.network.connection=="undefined"){navigator.network.connection=new Connection()}})};