var GeolocationJS={akamaiCountryCode:"",geoLocateCookieValue:"",showPosition:function(position){if(position!==undefined&&position!=null){storeLocatorJS.refreshResultsFromNearest(position.coords.latitude,position.coords.longitude);}},locationError:function(error){var errorMsgKey;switch(error.code){case error.PERMISSION_DENIED:errorMsgKey="LBS_ERROR_PERMISSION_DENIED";break;case error.POSITION_UNAVAILABLE:errorMsgKey="LBS_ERROR_NO_USER_CURRENT_LOC";break;case error.TIMEOUT:errorMsgKey="LBS_ERROR_TIMEOUT";break;default:break;}
storeLocatorJS.refreshResultsWithLocationError(errorMsgKey);},launch:function(){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(GeolocationJS.showPosition,GeolocationJS.locationError,{timeout:10000,enableHighAccuracy:true});}},getAkamaiCountryCode:function(){var akamaiCountryCode="";var xAkamaiEdgescape;try{var geoCookieValue=this.getValueFromCookie("X-MAT-GEO");if(typeof geoCookieValue!=undefined&&null!=geoCookieValue&&geoCookieValue!=""){xAkamaiEdgescape=geoCookieValue;}
if(typeof xAkamaiEdgescape!="undefined"&&xAkamaiEdgescape!=null){var headerParams=xAkamaiEdgescape.split(/\s*,\s*/);for(count=0;count<headerParams.length;count++){var params=headerParams[count].split(/\s*=\s*/);this.akamaiCountryCode=params[1];if(params[0]=="country_code"){break;}}}}catch(err){var xAkamaiEdgescape="";}},getValueFromCookie:function(cookieKey){this.geoLocateCookieValue=dojo.cookie(cookieKey);return this.geoLocateCookieValue;},createCookie:function(cookieKey,newCookieValue){dojo.cookie(cookieKey,newCookieValue,{path:"/"});},geoLocationShip:function(){this.getAkamaiCountryCode();console.log("akamaicc="+this.akamaiCountryCode);if(this.akamaiCountryCode=='CA'){var cookieVal=this.getValueFromCookie("geoLocate");if(cookieVal==undefined||cookieVal==null||cookieVal==""){this.createCookie("geoLocate",this.akamaiCountryCode);}}}}