(function(){"use strict";var e="http://maps.apple.com/?";var n="geo:";var r="http://www.bing.com/maps/default.aspx?";u8.Mobile.Application.registerAction("openmap",function(e){var n=t(e);if(n){u8.application.execute({name:"openurl",url:n,target:"_blank"})}});function t(e){var n=u(e);if(!n){return null}for(var r=0;r<i.length;r++){var t=i[r];if(t.isRelevant()){return t.getUrl(n.value,n.isGeo,n.displayName)}}return null}var i=[{isRelevant:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},getUrl:function(n,r){if(r){return e+"ll="+a(n)+"&q="+a(n)}else{return e+"q="+n}}},{isRelevant:function(){return navigator.userAgent.match(/Android/i)},getUrl:function(e,r,t){if(r){return n+a(e)+"?q="+a(e)+"("+t+")"}else{return n+"0,0?q="+e}}},{isRelevant:function(){return true},getUrl:function(e,n,t){if(n){return r+"sp=Point."+a(e,"_")+"_"+f(t)+"_"+"&lvl=15"}else{return r+"obox=1&where1="+f(e)}}}];function u(e){if(!e){return null}var n=false;var r;if(e.geo){n=true;r=l(e.geo);if(!r){return null}}else{if(!e.address){return null}r=o(e.address)}return{isGeo:n,value:r,displayName:o(e.displayName)}}function l(e){var n=e.split(" ");if(n.length!=2){return null}var r={latitude:n[0].replace(",","."),longitude:n[1].replace(",",".")};return r}function a(e,n){if(!e){return""}if(!n){n=","}return e.latitude+n+e.longitude}function o(e){return encodeURIComponent(f(e))}function f(e){return(e||"").replace(/\n/g," ")}})();