(function(c){if(!navigator.geolocation){var n=function(){setTimeout(function(){throw"document.write is overwritten by geolocation shim. This method is incompatible with this plugin";},1)},f=0,k=c.webshims.cfg.geolocation.options||{};navigator.geolocation=function(){var a,i={getCurrentPosition:function(i,d,g){var e=2,f,l,m,h=function(){if(!m)if(a){if(m=!0,i(c.extend({timestamp:(new Date).getTime()},a)),j(),window.JSON&&window.sessionStorage)try{sessionStorage.setItem("storedGeolocationData654321", JSON.stringify(a))}catch(b){}}else d&&!e&&(m=!0,j(),d({code:2,message:"POSITION_UNAVAILABLE"}))},p=function(){e--;o();h()},j=function(){c(document).unbind("google-loader",j);clearTimeout(l);clearTimeout(f)},o=function(){if(a||!window.google||!google.loader||!google.loader.ClientLocation)return!1;var b=google.loader.ClientLocation;a={coords:{latitude:b.latitude,longitude:b.longitude,altitude:null,accuracy:43E3,altitudeAccuracy:null,heading:parseInt("NaN",10),velocity:null},address:c.extend({streetNumber:"", street:"",premises:"",county:"",postalCode:""},b.address)};return!0};if(!a&&(o(),!a&&window.JSON&&window.sessionStorage))try{a=(a=sessionStorage.getItem("storedGeolocationData654321"))?JSON.parse(a):!1,a.coords||(a=!1)}catch(q){a=!1}a?setTimeout(h,1):k.confirmText&&!confirm(k.confirmText.replace("{location}",location.hostname))?d&&d({code:1,message:"PERMISSION_DENIED"}):(c.ajax({url:"http://freegeoip.net/json/",dataType:"jsonp",cache:!0,jsonp:"callback",success:function(b){e--;b&&(a=a||{coords:{latitude:b.latitude, longitude:b.longitude,altitude:null,accuracy:43E3,altitudeAccuracy:null,heading:parseInt("NaN",10),velocity:null},address:{city:b.city,country:b.country_name,countryCode:b.country_code,county:"",postalCode:b.zipcode,premises:"",region:b.region_name,street:"",streetNumber:""}},h())},error:function(){e--;h()}}),clearTimeout(l),!window.google||!window.google.loader?l=setTimeout(function(){if(k.destroyWrite)document.write=n,document.writeln=n;c(document).one("google-loader",p);c.webshims.loader.loadScript("http://www.google.com/jsapi", !1,"google-loader")},800):e--,f=g&&g.timeout?setTimeout(function(){j();d&&d({code:3,message:"TIMEOUT"})},g.timeout):setTimeout(function(){e=0;h()},1E4))},clearWatch:c.noop};i.watchPosition=function(a,c,g){i.getCurrentPosition(a,c,g);f++;return f};return i}();c.webshims.isReady("geolocation",!0)}})(jQuery);