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

Fp.OwnerContent={content:{},isOwnerContent:true,init:function(b,a){this.setData(b,a);this.fillData();this.setupEvents();return this;},setupEvents:function(){new Fp.Utils.addTapEvent({element:Fp.byId("owner-content").getElementsByTagName("a")[0],onEvent:function(){Fp.Pages.showPage({name:Fp.Pages.PAGE.MAIN,fromHistory:true});},BGposition:"0 0"});if(this.content.mobilePhone&&Fp.byId("owner-content-mobilephone")){new Fp.Utils.addTapEvent({element:Fp.byId("owner-content-mobilephone"),onEvent:function(){Fp.Api.fireC2A({hook:Fp.Api.C2Aid.DIAL,args:Fp.OwnerContent.content.mobilePhone});},BGposition:"0 0"});}},setData:function(b,a){this.content.name=a;this.content.description=b.descriptions.description.localizedDescription;this.content.businessHours=b.businessHours||"";this.content.paymentMethods=b.paymentMethods||"";this.content.mobilePhone=b.mobilePhone||"";this.provider=Fp.Lang.getTranslationForToken("places.ownername3");this.className="ownerContent";this.description=this.content.description;if(this.content.paymentMethods){this.content.paymentMethods.paymentMethod=this.content.paymentMethods.paymentMethod||this.content.paymentMethods.paymentMetod;}this.isAdPlace=true;},fillData:function(){var e=this.content;if(e.description){var c=Fp.byId("owner-content-description");c.firstChild.innerHTML=c.firstChild.innerHTML+" "+e.name;c.lastChild.innerHTML=e.description;c.removeAttribute("class");}if(e.businessHours&&e.businessHours.openingSchedule&&e.businessHours.openingSchedule.openingHours){var h=e.businessHours.openingSchedule.openingHours,g=[],f,j=Fp.byId("owner-content-openinghours");for(f in h){g.push(h[f].dayOfWeek);g.push(" - ");g.push(h[f].openFrom);g.push(" / ");g.push(h[f].openTo);g.push("<br />");}j.lastChild.innerHTML=g.join("");j.removeAttribute("class");}if(e.paymentMethods&&e.paymentMethods.paymentMethod){var g=[],f,b=Fp.byId("owner-content-paymentmethod");for(f in e.paymentMethods.paymentMethod){g.push(e.paymentMethods.paymentMethod[f].name);}if(g.length>0){b.lastChild.innerHTML=g.join(", ");b.removeAttribute("class");}}if(e.mobilePhone){var d=Fp.byId("owner-content-mobilephone");d.lastChild.innerHTML=e.mobilePhone;d.removeAttribute("class");}if(e.businessHours.annualClosings){var a=e.businessHours.annualClosings,g=[],f,k=Fp.byId("owner-content-annualclosing");for(f in a){g.push(a[f].closedFrom);g.push(" - ");g.push(a[f].closedTo);g.push("<br />");}k.lastChild.innerHTML=g.join("");k.removeAttribute("class");}},getTranslatedDescription:function(b,d){var a=b.length,c;for(c=0;c<a;c++){if(d.indexOf(b[c].languageOfDescription)===0){return b[c].localizedDescription;}}return null;},isProviderPrimePlace:function(a){return a.isAdPlace;}};