function LoadCurrencyDropDownTemplate(n,t){if(void 0==n)return!0;var i="";$.each(n.Table,function(n,t){i+="<option value="+t.CurrencyId+">"+t.CurrencyName+"</option>>"}),t="#"+t,$(t).html(i),ValidateIP(),(null==$.cookie("LanguageId")||""==$.cookie("LanguageId"))&&($.cookie("LanguageId",1,{expires:7,path:"/"}),$("#spnLanguage1").addClass("activeLanguage")),null==$.cookie("CurrencyId")||""==$.cookie("CurrencyId")?($.cookie("CurrencyId",3,{expires:7,path:"/"}),$.cookie("CurrencyName","HKD",{expires:7,path:"/"}),$("#spnSelectedCurrency").text($.cookie("CurrencyName")),(null==$.cookie("LanguageId")||""==$.cookie("LanguageId"))&&($.cookie("LanguageId",1,{expires:7,path:"/"}),$("#spnLanguage1").addClass("activeLanguage")),$(t+" option[value="+$.cookie("CurrencyId")+"]").attr("selected","selected")):($(t+" option[value="+$.cookie("CurrencyId")+"]").attr("selected","selected"),$("#spnLanguage"+$.cookie("LanguageId")).addClass("activeLanguage")),$.cookie("CurrencyName",$("#drpCurrency option:selected").text(),{expires:7,path:"/"})}function SetBookmarkedPropertyPriceConversion(n){if(void 0==n||""==n||"undefined"==n)return!0;var t=[],i=[];$.each(n,function(n,r){var u={},f={};f.PropertyId=r.PropertyId,u.PropertyId=r.PropertyId,u.PhotoPath=r.PhotoPath,u.CityName=r.CityName,u.StateName=r.StateName,u.CountryName=r.CountryName,u.ReferenceId=r.ReferenceId,u.Price=r.Price,u.Size=r.Size,u.SoleAgent=r.IsSoleAgent,u.CompanyName=r.CompanyName,u.ContactPerson=r.ContactPerson,u.Phone=r.Phone,u.Email=r.Email,u.website=r.website,u.FullRefID=r.FullRefID,t.push(u),i.push(f)}),$.cookie("InternationalBookmark",JSON.stringify(i),{expires:7,path:"/"}),localStorage.setItem("InternationalBookmark",JSON.stringify(t))}function SetBookmarkedPropertyPriceConversion_HK(n){if(void 0==n||""==n||"undefined"==n)return!0;var t=[],i=[];$.each(n,function(n,r){var f={},u;f.PropertyId=r.ID,u={},u.PropertyId=r.ID,u.Name=r.Name,u.PhotoPath=r.PropertyPhoto,u.ReferenceId=r.ID,u.Price=r.Price,u.Size=r.Size,u.SoleAgent=r.IsSoleAgent,u.BookmarkedDate=r.BookmarkedDate,u.PrependToURL=r.prependToURL,t.push(u),i.push(f)}),$.cookie("PropertyBookmark",JSON.stringify(i),{expires:7,path:"/"}),localStorage.setItem("PropertyBookmark",JSON.stringify(t))}function buildNewsInsights(n,t,i){var r="";1==GetCurrentLanguage()||2==GetCurrentLanguage()||GetCurrentLanguage(),$("#newsInsightsContainer").empty(),$.ajax({type:"POST",url:"/NewsInsights/InsightsDetails.aspx/GetNewsInsights",data:JSON.stringify({tagsToPass:null==n||void 0==n?"":n,languageid:t,templateid:i}),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){n=JSON.parse(n.d);var u=GetCurrentLanguage(),i=1==u?"en":2==u?"zh-t":3==u?"zh-s":"en";0<n.Table.length?($(".newsInsights").show(),$.each(n.Table,function(n,t){var e="",f,o,s;if(null!=t.Title&&void 0!=t.Title&&(e=t.Title.substring(0,200)),f="",f=null!=t.SubTitle&&void 0!=t.SubTitle&&null!=t.Content?"Summary"==t.TemplateType.toString()?200<t.SubTitle.length?t.SubTitle.substring(0,200):t.SubTitle:200<t.Content.length?t.Content.substring(0,200):t.Content:200<t.Content.length?t.Content.substring(0,200):t.Content,r+="<article>",r+="<a href='"+WebsiteUrl+"/"+i+"/property-news/"+replaceSpecialCharacters(t.Url.replace(/\?/g,"").replace(/\s+/g,"-"))+"/"+t.TemplateId+"' title='"+replaceQuote($.htmlClean(e))+"'>",r=""!=t.ImageName?r+("<img alt='"+replaceQuote($.htmlClean(t.Title))+"' src='"+imagePath+ImageModules.Contents+"/"+ImageFolders.Original+"/"+t.ImageName+"'>"):r+("<img alt='"+replaceQuote($.htmlClean(t.Title))+"' src='"+WebsiteUrl+"/CommonContent/Images/summary-icn-small.gif' width='71' height='67' />"),r+="</a>",r+="<div>",r+="<b><a href='"+WebsiteUrl+"/"+i+"/property-news/"+replaceSpecialCharacters(t.Url.replace(/\?/g,"").replace(/\s+/g,"-"))+"/"+t.TemplateId+"' title='"+replaceQuote($.htmlClean(t.Title))+"'>"+e+"</a></b>",r+="<p>"+f+"</p>",r+="<p>","Summary"!=t.TemplateType.toString())if(""!=t.Authors){if(o=t.Authors.split("|"),r+="By: ",0<o.length){var e=o[0].split(",").slice(0,2),f=o[1].split(",").slice(0,2),o=o[2].split(",").slice(0,2),u;for(u in e,f){""!=e[u].trim()&&""!=f[u].trim()&&("okay.com"==f[u].trim().toString().toLowerCase()?r+=f[u].trim():(s=17<f[u].trim().length?f[u].trim().substring(0,17)+"...":f[u].trim(),r="2"==o[u].trim()||"5"==o[u].trim()?r+("<a href='"+WebsiteUrl+"/"+i+"/real-estate-agents/"+replaceSpecialCharacters(f[u].trim().replace(/\?/g,"").replace(/\s+/g,"-"))+"/"+e[u].trim()+"?ppid=1&pno=1' class='author' id='author_"+e[u].trim()+"' title='"+replaceQuote($.htmlClean(f[u].trim()))+"'>"+s+"</a>"):r+("<a href='"+WebsiteUrl+"/"+i+"/property-experts/"+replaceSpecialCharacters(f[u].trim().replace(/\?/g,"").replace(/\s+/g,"-"))+"/"+e[u].trim()+"' class='author' id='author_"+e[u].trim()+"' title='"+replaceQuote($.htmlClean(f[u].trim()))+"'>"+s+"</a>")));break}}}else r+="By: OKAY.com";else r+="By: OKAY.com";r+=" - "+t.UpdatedDate+"",r+="</p></div></article>"}),n="","1"==t?n="More Insights":"2"==t?n="更多評論":"3"==t&&(n="更多评论"),r+="<div class='moreInsights'><a title='"+replaceQuote($.htmlClean(n))+"' href='"+WebsiteUrl+"/"+i+"/property-news/'>"+n+"</a></div>",$("#newsInsightsContainer").append(r),$("#newsInsightsContainer > article b, #newsInsightsContainer > article p").dotdotdot()):("block"==$(".newsInsightsInner").css("display")&&$(".askAgentInner").css("margin-left","0px"),$(".newsInsightsInner").hide())},error:ErrorHandler,fail:FailureHandler})}function GetCurrentLanguage(){return null==$.cookie("LanguageId")?1:$.cookie("LanguageId")}function ErrorHandler(){hideLoader()}function FailureHandler(){hideLoader()}function replaceQuote(n){return n.replace(/\'/g,"`")}function replaceSpecialCharacters(n){return n.replace(/[&\/\\#,+()$~%@.'":*?<>{}]/g,"")}ImageModules={Agent:"Agent",Account:"Account",FloorPlan:"FloorPlan",LandRegistry:"LandRegistry",RatingValuation:"RatingValuation",Property:"Property",TransactionHistory:"TransactionHistory",ListingDocument:"ListingDocument",Building:"Building",District:"District",PropertyVideo:"PropertyVideo",STLTool:"STLTool",HotProperty:"HotProperty",CompanySearch:"CompanySearch",PropertyInfo:"PropertyInfo",TransactionReport:"TransactionReport",Contents:"Contents",AgentThumbnail:"AgentThumbnail"},ImageFolders={Original:"Original",Folder150:"Folder150",Source:"Source",Thumbnail:"Thumbnail",ContentThumbnail:"ContentThumbnail"},LikeTypes={NewsArticle:1,Question:2,Answer:3,Summary:4},CommentTypes={NewsArticle:1,Question:2,Answer:3,Summary:4}