var bb_successCallback;var bb_errorCallback;function handleBlackBerryLocation(){if(bb_successCallback&&bb_errorCallback){if(blackberry.location.latitude==0&&blackberry.location.longitude==0){bb_errorCallback({message:"Position unavailable",code:2})}else{var a=null;if(blackberry.location.timestamp){a=new Date(blackberry.location.timestamp)}bb_successCallback({timestamp:a,coords:{latitude:blackberry.location.latitude,longitude:blackberry.location.longitude}})}bb_successCallback=null;bb_errorCallback=null}}var geolocate=function(){var a={};var b=null;a.getCurrentPosition=function(c,d,e){b.getCurrentPosition(c,d,e)};a.init=function(){try{if(typeof(navigator.geolocation)!="undefined"){b=navigator.geolocation;a.getCurrentPosition=function(d,e,f){function g(h){if(typeof(h.latitude)!="undefined"){d({timestamp:h.timestamp,coords:{latitude:h.latitude,longitude:h.longitude}})}else{d(h)}}b.getCurrentPosition(g,e,f)}}else{if(typeof(window.google)!="undefined"){b=google.gears.factory.create("beta.geolocation");a.getCurrentPosition=function(d,f,g){try{b.getCurrentPosition(d,f,g)}catch(h){f({message:h,code:1})}}}else{if(typeof(window.blackberry)!="undefined"&&blackberry.location.GPSSupported){blackberry.location.setAidMode(2);a.getCurrentPosition=function(d,e,f){bb_successCallback=d;bb_errorCallback=e;blackberry.location.onLocationUpdate("handleBlackBerryLocation()");blackberry.location.refreshLocation()};b=blackberry.location}}}}catch(c){if(typeof(console)!="undefined"){console.log(c)}}return b!=null};return a}();
