//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(e,b){this.content.name=b;if(e.descriptions&&e.descriptions.description&&e.descriptions.description.localizedDescription){this.content.description=e.descriptions.description.localizedDescription;}else{this.content.description="";}this.content.businessHours=e.businessHours||"";this.content.paymentMethods=e.paymentMethods||"";this.content.mobilePhone=e.mobilePhone||"";if(e.mediaTypes&&e.mediaTypes.adPlaceMedia&&e.mediaTypes.adPlaceMedia.length>0){var d=e.mediaTypes.adPlaceMedia.length;var f=e.mediaTypes.adPlaceMedia;var a=[];for(var c=0;c<d;c++){if(f[c].mediaType==="IMAGE"){a.push(f[c].mediaUrl);}}this.content.gallery=a;}else{this.content.gallery=[];}this.provider=Fp.Lang.getTranslationForToken("places.ownername3");this.providerDisplayName=this.provider;this.className="ownerContent";this.description=this.content.description;if(this.content.paymentMethods){this.content.paymentMethods.paymentMethod=this.content.paymentMethods.paymentMethod||this.content.paymentMethods.paymentMetod;}providedByEl=Fp.byId("owner-content-provided-by");if(e.provider){providedByEl.innerHTML=Language["places.providedBy"]+": "+e.provider;providedByEl.style.display="block";if(e.providerUrl){providedByEl.href="search://C2A?C2Aid=257&Version=1.0&260="+encodeURI(e.providerUrl);}}else{Fp.byId("owner-content-provided-by").style.display="none";}this.isAdPlace=true;},fillData:function(){var e=this.content,c=Fp.byId("owner-content-description");if(e.description){c.firstChild.innerHTML=Language["places.description"]+" "+e.name;c.lastChild.innerHTML=e.description;c.removeAttribute("class");}else{c.className="hidden";}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");}else{Fp.byId("owner-content-openinghours").className="hidden";}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");}}else{Fp.byId("owner-content-paymentmethod").className="hidden";}if(e.mobilePhone){var d=Fp.byId("owner-content-mobilephone");d.lastChild.innerHTML=e.mobilePhone;d.removeAttribute("class");}else{Fp.byId("owner-content-mobilephone").className="hidden";}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");}else{Fp.byId("owner-content-annualclosing").className="hidden";}},fillThumbnails:function(){if(this.content.gallery&&this.content.gallery.length>0){Fp.Gallery.setUpThumbnails();}else{Fp.byId("owner-content-gallerythumbs").className="hidden";}},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;}};