var ProfileCards=new Class({options:{delayToShow:1000},initialize:function(){this.elemsById=[];this.profileCard=null;document.addEvent("click",function(){if(this.profileCard){this.profileCard.close()}}.bind(this))},setupCard:function(e,a){var d=function(){if(this.elemsById[a]===undefined){var f=new ApiClient({apimethod:"igloo/widgets/27/render",postdata:{paramList:"idList,triggerId",paramTypes:"string,string"},queryparams:{idList:a,triggerId:e.id},onRequest:function(){},onSuccess:function(g,i){var h=JSON.decode(g,true);if(h===null){return false}var j=JSON.decode(h.response.items[2].value);if(j===null){return false}$each(j,function(k,l){this.elemsById[l]=k}.bind(this));if(this.spinnerId!==undefined){this.spinnerId=igLoadingCursor.removeLoader(this.spinnerId);this.drawProfileCard(e,a)}}.bind(this)})}}.bind(this);var c=function(f,g){if(this.elemsById[g]!==undefined){this.drawProfileCard(f,g)}else{this.spinnerId=igLoadingCursor.addLoader()}};var b;e.addEvent("mouseenter",function(){d();b=c.delay(this.options.delayToShow,this,[e,a])}.bind(this));e.addEvent("mouseleave",function(){window.clearTimeout(b)})},drawProfileCard:function(a,c){var d=this.elemsById[c];if(this.profileCard){this.profileCard.close()}this.profileCard=new Minimodal({injectat:"top",injectpoint:document.body,trigger:a,"x-offset":-10,"y-offset":-10,customclass:"ig-minimodal-profile",width:350});a.profileCard=this.profileCard;var b=new Element("div",{"class":"ig-profilecard-wrapper clearfix vcard",html:d}).inject(this.profileCard.contentformnobr,"top");b.getElements("img").addEvent("load",function(){this.profileCard.resize()}.bindWithEvent(this));this.profileCard.minimodalform.addEvent("click",function(e){e.stopPropagation()});this.profileCard.shadow();bootstrap(b)}});var PC=new ProfileCards();window.addEvent("bootstrap4finished",function(){if(window.dependents.ProfileCards){window.dependents.ProfileCards.each(function(b){if(b.dataobj){var a=$type(b.dataobj)=="string"?JSON.decode(b.dataobj):b.dataobj;if(a&&a.ProfileCards&&a.ProfileCards.UserId){var c=a.ProfileCards.UserId.replace(/\{/g,"").replace(/\}/g,"");PC.setupCard(b,c)}}})}});window.addEvent("domready",function(){if(Igloo.asset_ProfileCards){$each(Igloo.asset_ProfileCards,function(c,b){if(c.UserId){var a=$(b);if(a){PC.setupCard(a,c.UserId)}}})}});
