//Copyright © [Year(s)] Nokia Corporation and/or its subsidiary(-ies).
Fp.Menu={menuContact:null,menuNavigate:null,menuRate:null,menuShare:null,menuRate:null,menuSave:null,placeId:null,connectMenu:null,init:function(){this.menuContact=Fp.byId("contact");this.menuNavigate=Fp.byId("navigate");this.menuRate=Fp.byId("rate");this.menuShare=Fp.byId("share");this.menuReport=Fp.byId("report");this.menuSave=Fp.byId("save");this.connectMenu=Fp.byId("connect-menu");this.bodyTag=document.getElementsByTagName("body")[0];this.setupEvents(this.fireAction);},setupEvents:function(d){var c=Fp.byId("connect-menu").childNodes;for(var b=0,a=c.length;b<a;b++){if(c[b].id){new Fp.Utils.Events.addTapEvent({element:c[b],onEvent:d});}}},setView:function(){this.placeId=Fp.POI.placeId;this.resetMenu();if(!Fp.POI.isPlace){Fp.Utils.addClass(this.menuContact,"hidden");Fp.Utils.addClass(this.menuRate,"hidden");Fp.Utils.addClass(this.menuReport,"hidden");Fp.Utils.addClass(this.bodyTag,"notPlace");this.connectMenu.className="elements-3";return;}else{if((Fp.POI.online!==1||Fp.POI.placeLoadeFailed)&&Fp.POI.isPlace){Fp.Utils.addClass(this.menuRate,"disabled");Fp.Utils.addClass(this.menuReport,"disabled");if(Fp.POI.latitude=="undefined"||Fp.POI.longitude=="undefined"){Fp.Utils.addClass(this.menuShare,"disabled");}}else{var a=this.connectMenu.getElementsByTagName("LI");Fp.Utils.addClass(a[a.length-1],"last");}}this.connectMenu.className="elements-6";if(!Fp.Menu.Contact.contactDetailsPresent){Fp.Utils.addClass(this.menuContact,"disabled");}},fireAction:function(c){if(c.target.className.indexOf("disabled")!=-1||c.target.parentNode.className.indexOf("disabled")!=-1){return;}var b;if(c.target.id){b=c.target.id;}else{b=c.target.parentNode.id;}switch(b){case"contact":Fp.Pages.showPage({name:Fp.Pages.PAGE.CONTACT});break;case"navigate":Fp.Pages.showPage({name:Fp.Pages.PAGE.NAVIGATE});break;case"rate":Fp.Pages.showPage({name:Fp.Pages.PAGE.RATE});break;case"share":Fp.Pages.showPage({name:Fp.Pages.PAGE.SHARE});break;case"report":Fp.Menu.Report.showPage();break;case"save":var a=function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.SAVE_LANDMARK});};if(!Fp.Tracking.trackingOn){a();}else{Fp.Tracking.track("saveClicked",{callback:function(){a();}});}break;}},resetMenu:function(){Fp.Utils.removeClass(this.bodyTag,"notPlace");this.menuContact.className=this.menuContact.id;this.menuNavigate.className=this.menuNavigate.id;this.menuRate.className=this.menuRate.id;this.menuShare.className=this.menuShare.id;this.menuReport.className=this.menuReport.id;this.menuSave.className=this.menuSave.id;}};