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

Fp.ConnectMenu={init:function(){this.setupEvents();this.setupVisuals();},setupVisuals:function(){this.toggleOneRow({element:Fp.byId("connectMenuCategory"),value:Fp.Lang.getCategLabel(Fp.POI.category.name),fillTheSame:true});this.toggleOneRow({element:Fp.byId("connectMenuProvider"),value:Fp.POI.provider,elemToFill:Fp.byId("providerName")});this.toggleOneRow({element:Fp.byId("phone"),value:Fp.POI.contact.phone,elemToFill:Fp.byId("phone-value")});this.toggleOneRow({element:Fp.byId("website"),value:Fp.POI.contact.website});this.toggleOneRow({element:Fp.byId("email"),value:Fp.POI.contact.email});this.toggleOneRow({element:Fp.byId("rating"),value:Fp.POI.rating});this.toggleOneRow({element:Fp.byId("report-places"),value:(Fp.POI.isPlace&&Fp.POI.online&&Fp.POI.placeId)});},toggleOneRow:function(a){if(a&&a.element){if(!a.value){a.element.style.display="none";}else{a.element.style.display="block";if(a.elemToFill){a.elemToFill.innerHTML="";a.elemToFill.innerHTML=a.value;}if(a.fillTheSame===true){a.element.innerHTML="";a.element.innerHTML=a.value;}}}},setupEvents:function(){new Fp.Utils.addTapEvent({element:Fp.byId("phone"),onEvent:function(){if(Fp.Tracking&&Fp.Tracking.trackingOn){Fp.Tracking.track("telephoneClicked",function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.DIAL});});}else{Fp.Api.fireC2A({hook:Fp.Api.C2Aid.DIAL});}},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("rating"),onEvent:function(){Fp.Pages.showPage({name:Fp.Pages.PAGE.RATINGS});},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("walk-to"),onEvent:function(){if(Fp.Tracking&&Fp.Tracking.trackingOn){Fp.Tracking.track("walkToClicked",function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.WALK_TO});});}else{Fp.Api.fireC2A({hook:Fp.Api.C2Aid.WALK_TO});}},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("drive-to"),onEvent:function(){if(Fp.Tracking&&Fp.Tracking.trackingOn){Fp.Tracking.track("driveToClicked",function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.NAVIGATE_TO});});}else{Fp.Api.fireC2A({hook:Fp.Api.C2Aid.NAVIGATE_TO});}},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("add-to-fav"),onEvent:function(){if(Fp.Tracking&&Fp.Tracking.trackingOn){Fp.Tracking.track("saveClicked",function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.SAVE_LANDMARK});});}else{Fp.Api.fireC2A({hook:Fp.Api.C2Aid.SAVE_LANDMARK});}},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("website"),onEvent:function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.BROWSE});},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("send-place"),onEvent:function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.SEND});},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("email"),onEvent:function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.MAILTO});},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("add-to-route"),onEvent:function(){if(Fp.Tracking&&Fp.Tracking.trackingOn){Fp.Tracking.track("addToRouteClicked",function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.ADD_TO_ROUTE});});}else{Fp.Api.fireC2A({hook:Fp.Api.C2Aid.ADD_TO_ROUTE});}},checkHeight:true});new Fp.Utils.addTapEvent({element:Fp.byId("report-places"),onEvent:function(){Fp.Pages.showPage({name:Fp.Pages.PAGE.REPORTPLACE});Fp.Incident.prefillForms();},checkHeight:true});}};