//Copyright © [Year(s)] Nokia Corporation and/or its subsidiary(-ies).

Fp.Tracking={trackingOn:true,imageId:"trackingImage",trackingImage:null,metricEnv:"nokiaglobalmcg0prod",uuid:"noUUIDAvail",lang:"en:gb",premiumContentProvider:"noProviderAvail",placeId:"noPlaceIdAvail",init:function(){if(document.getElementById(this.imageId)){this.trackingImage=document.getElementById(this.imageId);}else{this.trackingOn=false;}},load:function(){if(this.trackingImage===null){this.init();}this.setLang();this.setUUID();this.getPlaceId();this.setPremiumContentProvider();this.track("viewDetails");},track:function(b,a){if(!b||!this.trackingOn||typeof this[b]!=="function"){return false;}if(a){this[b](a);}else{this[b]();}},setImageSrc:function(b,c){if(b){this.trackingImage.src="";var a="http://metrics.nokia.com/b/ss/"+this.metricEnv+"/5/"+this.createRandom()+"?D=~&c6=ovimapsmcg0&vid="+this.getUUID()+"&c23="+this.getLang()+"&v13="+this.getPlaceId()+"&v7=~gn&h1=~gn&v23=~c23&"+b;this.trackingImage.src=a;if(this.trackingImage.src==a&&typeof c==="function"){setTimeout(c,100);}}else{return false;}},createRandom:function(){return Math.floor(Math.random()*54321)*12345;},viewDetails:function(){this.setImageSrc("gn=~ch%2B%22:places:details%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1");},moreInformation:function(){this.setImageSrc("gn=~ch%2B%22:places:details:more%20information%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1,event31");},otherProvider:function(a){this.setPremiumContentProvider();this.setImageSrc("gn=~ch%2B%22:places:details:other%20provider%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1");},rateContent:function(){this.setImageSrc("gn=~ch%2B%22:places:details:rate%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1,event18");},walkToClicked:function(a){this.setImageSrc("gn=~ch%2B%22:places:details:walk%20to%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1,event16",a);},driveToClicked:function(a){this.setImageSrc("gn=~ch%2B%22:places:details:drive%20to%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1,event17",a);},addToRouteClicked:function(a){this.setImageSrc("gn=~ch%2B%22:places:details:add%20to%20route%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1,event21",a);},saveClicked:function(a){this.setImageSrc("gn=~ch%2B%22:places:details:save%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1,event22",a);},telephoneClicked:function(a){this.setImageSrc("gn=~ch%2B%22:places:details:telephone%22&ch=ovi:maps:mc&c11=mc&v11=mc&c14="+this.getPremiumContentProvider()+"&v14=~c14&ev=event1,event13",a);},getPremiumContentProvider:function(){if(this.premiumContentProvider==="noProviderAvail"){this.setPremiumContentProvider();}return encodeURI(this.premiumContentProvider);},setPremiumContentProvider:function(){if(Fp.PremiumContent){this.premiumContentProvider=(Fp.PremiumContent.providers&&Fp.PremiumContent.selectedIndex>=0)?Fp.PremiumContent.providers[Fp.PremiumContent.selectedIndex].provider.toLowerCase():"noProviderAvail";}},setLang:function(){this.lang=(Fp.Lang.language)?this.formatLanguage(Fp.Lang.language):"noLangAvail";},getLang:function(){if(this.lang==="noLangAvail"){this.setLang();}return this.lang;},setUUID:function(){this.uuid=(Fp.uuid)?Fp.uuid:"noUUIDAvail";},getUUID:function(){if(this.uuid==="noUUIDAvail"){this.setUUID();}return this.uuid;},setPlaceId:function(){this.placeId=(Fp.POI&&Fp.POI.placeId)?Fp.POI.placeId:"noPlaceIdAvail";},getPlaceId:function(){if(this.placeId==="noPlaceIdAvail"){this.setPlaceId();}return this.placeId;},formatLanguage:function(a){return a.replace(/-/g,":");}};