Function.prototype.inherits=function(a){function b(){}b.prototype=a.prototype;this.superClass_=a.prototype;this.prototype=new b();this.prototype.constructor=this};var gadgets=gadgets||{};gadgets.remoteServiceFactory=function(){var a={};var b={};b.basic=function(){};b.basic.prototype._buildUrlForSandboxView=function(c,i,g){var d;
d=gadgets.baseUrl;var e="link";var h=false;switch(c.toLowerCase()){case"nobleprofile":if(g.profileId){d+=gadgets.sandbox.url.profile+g.aid+"/"+g.v;d+="/owner/"+g.profileId}else{return false}break;case"profile":if(g.profileId){d+=gadgets.sandbox.url.profile+g.aid+"/"+g.v;d+="/owner/"+g.profileId}else{return false
}break;case"start":return false;break;case"group":case"groupinstallation":if(g.groupId){d+=gadgets.sandbox.url.group+g.aid+"/"+g.v}else{return false}break;case"popup":case"popupinstallation":d+=gadgets.sandbox.url.popup+g.aid+"/"+g.v;if(g.profileId){d+="/owner/"+g.profileId}e="popup";break;case"integration":case"integrationinstallation":d+=gadgets.sandbox.url.integration+g.aid+"/"+g.v;
break;case"preview":d+=gadgets.sandbox.url.preview+g.aid+"/"+g.v;h=true;break;case"canvas":case"nobleprofilecanvas":if(g.profileId){d+=gadgets.sandbox.url.canvas+g.aid+"/"+g.v;d+="/owner/"+g.profileId}else{return false}break;case"groupcanvas":case"groupcanvasinstallation":if(g.groupId){d+=gadgets.sandbox.url.groupcanvas+g.aid+"/"+g.v
}else{return false}break;default:return false;break}if(i){var f=JSON.stringify(i);if(f.length>0){d+="/params/"+encodeURIComponent(encodeURIComponent(f))}}return{type:e,url:d,close:h}};b.basic.prototype._buildUrlForView=function(c,i,g){if(gadgets.sandbox){return this._buildUrlForSandboxView(c,i,g)}var d;
d=gadgets.baseUrl;var e="link";var h=false;switch(c.toLowerCase()){case"nobleprofile":if(g.profileId){d+="/Profile/"+g.profileId}else{return false}break;case"profile":if(g.profileId){d+="/Gadgets/MyGallery/"+g.profileId+"/"+g.mid}else{return false}break;case"start":return false;break;case"group":case"groupinstallation":if(g.groupId){d+="/Groups/Overview/"+g.groupId
}else{return false}break;case"popup":case"popupinstallation":d+="/Gadgets/Popup/"+g.aid;if(g.profileId){d+="/profileId/"+g.profileId}e="popup";break;case"integration":case"integrationinstallation":d+="/Gadgets/Integration/"+g.aid;break;case"preview":d+="/Gadgets/Install/"+g.aid+"/";h=true;break;case"canvas":case"nobleprofilecanvas":if(g.view=="embed"){d+="/Gadgets/Install/"+g.aid+"/"
}else{if(g.profileId){d+="/Gadgets/Canvas/"+g.mid;d+="/profileId/"+g.profileId;if(g.position=="front"){d+="/r/profile"}}else{return false}}break;case"groupcanvas":case"groupcanvasinstallation":if(g.groupId){d+="/Gadgets/GroupCanvas/"+g.mid;d+="/groupId/"+g.groupId}else{return false}break;default:return false;
break}if(i){var f=JSON.stringify(i);if(f.length>0){d+="/params/"+encodeURIComponent(encodeURIComponent(f))}}return{type:e,url:d,close:h}};b.basic.prototype._convertPossibleOsIdAlias=function(d,f){var c=d;var e=d.toLowerCase();if(e=="owner"){c=f.o}else{if(e=="viewer"){c=f.vw}}return c};b.basic.prototype._getEncodedRecipientString=function(c,g){var e=new Array();
var f;var h="";if(typeof c==="string"){f=this._convertPossibleOsIdAlias(c,g);e.push(encodeURIComponent(f))}else{if(typeof c==="object"){for(var d in c){f=this._convertPossibleOsIdAlias(c[d],g);e.push(encodeURIComponent(f))}}}if(c.length>0){h="&openSocialIds[]="+e.join("&openSocialIds[]=")}return h};b.basic.prototype.showPaymentInterstitial=function(c,d,e){Phx.UI.Dialog.ButtonDialog(i18n.getText("gadgets_payment_dialog_header"),{message:i18n.getPText("gadgets_payment_dialog"),buttons:[new Phx.UI.Button.Submit(i18n.getText("gadgets_payment_proceed"),true),new Phx.UI.Button.Submit(i18n.getText("gadgets_payment_cancel"),false)],events:{onButtonClicked:function(f){if("false"===f||false===f){if(typeof e==="function"){e(false)
}}if(typeof e==="function"){e(true)}}}}).show()};b.basic.prototype.getPermissions=function(c,e,g){var d=c[0].userId;if(d==="VIEWER"){d=e.vw}else{if(d==="OWNER"){d=e.o}}var f="&installationId="+e.mid+"&gadgetId="+e.aid+"&userId="+d;Phx.Application.RequestRegistry.append({1:"Gadgets_getPermissions",2:function(h){g(h.module.data.permissions)
},3:"",4:f})};b.basic.prototype.writeFeedEntry=function(c,d,f){var e="&message="+encodeURIComponent(c[0].body)+"&url="+encodeURIComponent(c[0].url);e+="&gadgetId="+d.aid;e+="&gadgetRevisionId="+d.v;if(c[0].body.length>140){f({result:false,msg:"invalid body length"});return}Phx.Application.RequestRegistry.append({1:"Gadgets_feedEntryDialog",2:function(g){var i=Phx.UI.Dialog.HTML(i18n.getText("feed_write_dialog"),{message:g.module.data.html});
i.show();$(".Write-Feed-Text").html(Phx.Util.linkify($(".Write-Feed-Text").html(),{wrap:38,embedActive:true,maxItems:1}));Phx.Util.OEmbedThumb($(".Write-Feed-Text").parent());var h=function(j,k){i.close();if(typeof f==="function"){f({result:j,msg:k})}};$("#Write-Feed-Message-Close").unbind("click").bind("click",function(){h(false,"user canceled request")
});$("#Write-Feed-Message-Save").unbind("click").bind("click",function(){Phx.Application.RequestRegistry.append({1:"Gadgets_feedEntry",2:function(){h(true)},3:"",4:e})})},3:"",4:e})};b.basic.prototype.updatePerson=function(c,d,f){var e="&gadgetId="+d.aid;e+="&gadgetRevisionId="+d.v;e+="&newImage="+encodeURIComponent(c[0].person.fields_.thumbnailUrl);
if(gadgets.sandbox){e+="&sandbox=1"}Phx.Application.RequestRegistry.append({1:"Profile_getUpdateImageForm",2:function(g){var h=Phx.UI.Dialog.HTML(i18n.getText("upload_profile_picture"),{message:g.module.data.html});h.show();$("#close-dialog-save").click(function(){if(gadgets.sandbox){h.close();f(true);
return}Phx.Application.RequestRegistry.append({1:"Profile_updateImage",2:function(i){h.close();f(true)},3:"",4:e})});$("#close-dialog-cancel").click(function(){h.close();f(false)})},3:"",4:e})};b.basic.prototype.sendPublicMessage=function(c,d,g){var f=this._getEncodedRecipientString(c[0].recipients,d);
var e="&disableMultiRec=0&message="+encodeURIComponent(c[0].body)+f+"&gadgetId="+d.aid+"&gadgetRevisionId="+d.v;Phx.Application.RequestRegistry.append({1:"Gadgets_pinboardMessageDialog",2:function(h){var i=Phx.UI.Dialog.HTML(i18n.getText("pinboard_write_dialog"),{message:h.module.data.html});i.show();
var j=$("#maxRecipientCount").val();var l={maxFriendsCount:parseInt(j),maxFriendsListsCount:0};Phx.Application.Modules.WriteMessage.resetFriendList();Phx.Application.Modules.WriteMessage.init(l);var k=$(".dialog-content .pinboard-entry-text");k.html(Phx.Util.linkify(k.html(),{embedActive:true},true));
Phx.Util.OEmbed(k,300,400);$("#Write-Pinboard-Message-Close").unbind("click").bind("click",function(){i.close();if(typeof g==="function"){g(false)}});$("#Write-Pinboard-Message-Send").unbind("click").bind("click",function(){var n="&gadgetId="+d.aid+"&message="+encodeURIComponent(c[0].body)+"&gadgetRevisionId="+d.v;
var m=$(".recipientIds");m.each(function(){n+="&recipientIds[]="+$(this).val()});Phx.Application.RequestRegistry.append({1:"Gadgets_pinboardMessage",2:function(o){i.close();if(typeof g==="function"){g(o.module.data.osRecipients)}},3:"",4:n})})},3:"",4:e})};b.basic.prototype.sendPrivateMessage=function(d,e,h){if(gadgets.sandbox){var c="&message="+encodeURIComponent(d[0].body)+"&gadgetId="+e.aid+"&gadgetRevisionId="+e.v;
Phx.Application.RequestRegistry.append({1:"Gadgets_messagePreview",2:function(i){var j=Phx.UI.Dialog.HTML("Preview Message",{message:i.module.data.html});j.show();var k=$(".dialog-content #Preview-Message");k.html(Phx.Util.linkify(k.html(),{embedActive:true},true));Phx.Util.OEmbed(k,300,400);$("#MessagePreview-Close").unbind("click").bind("click",function(){j.close();
if(typeof h==="function"){h(true)}})},3:"",4:c});return}var g=this._getEncodedRecipientString(d[0].recipients,e);var f="&message="+encodeURIComponent(d[0].body)+g+"&gadgetId="+e.aid;Phx.Application.RequestRegistry.append({1:"Gadgets_replyMessage",2:function(i){Phx.Application.Modules.WriteMessage.resetFriendList();
Phx.Application.Modules.WriteMessage.showReplyMessageDialog(i,d[0].subject,h);Phx.Application.Modules.WriteMessage.init()},3:"",4:f})};b.basic.prototype.getEmbedUrl=function(c,d,e){e(b.basic.prototype._getEmbedUrl(d,c))};b.basic.prototype.getStaticContentUrl=function(c,d,e){e(b.basic.prototype._getStaticContentEmbedUrl(d,c))
};b.basic.prototype.getStaticContent=function(c,d,f){var e="&gadgetId="+d.aid;e+="&gadgetRevisionId="+d.v;e+="&key="+encodeURIComponent(c[0].key);if(c[0].params){e+="&params="+encodeURIComponent(JSON.stringify(c[0].params))}Phx.Application.RequestRegistry.append({1:"Gadgets_getStaticKey",2:function(g){f(g.module.data.content)
},3:"",4:e})};b.basic.prototype.sendEmbed=function(c,d,f){if(gadgets.sandbox){var e="&gadgetId="+d.aid;e+="&ownerId="+d.o;e+="&gadgetRevisionId="+d.v;e+="&url="+encodeURIComponent(c[0].url);Phx.Application.RequestRegistry.append({1:"GadgetDeveloper_getEmbed",2:function(g){$("#Preview-Embed-Container").html(g.module.data.html);
gadgets.gadgetManager.setAllGadgets(gadgets.data);Phx.Application.Modules.gadgetscontroller.generateGadgets()},3:"",4:e});return}Phx.Application.Modules.Embed.handleGadgetCallback(c[0].url)};b.basic.prototype._getStaticContentEmbedUrl=function(e,d){if(gadgets.sandbox){var f="http://"+window.location.host+"/GadgetDeveloper/Static/"+e.aid+"/"+e.v+"/"+encodeURIComponent(d[0].key);
if(d[0].params){f+="/"+encodeURIComponent(JSON.stringify(d[0].params))}return f}var c="http://"+window.location.host+"/Gadgets/Static/"+e.aid+"/"+encodeURIComponent(d[0].key);if(d[0].params){c+="/"+encodeURIComponent(JSON.stringify(d[0].params))}return c};b.basic.prototype._getEmbedUrl=function(e,d){var c;
if(e.profileId){c="http://"+window.location.host+"/Gadgets/Embed/"+e.profileId+"/"+e.mid}else{c="http://"+window.location.host+"/Gadgets/IntegrationEmbed/"+e.vw+"/"+e.aid}if(gadgets.sandbox){c="http://"+window.location.host+"/GadgetDeveloper/Embed/"+e.vw+"/"+e.aid+"/"+e.v}if(d[0].param){c+="/"+encodeURIComponent(encodeURIComponent(d[0].param))
}return c};b.basic.prototype.suggest=function(d,e,g){var c={};if(d&&d[0]&&d[0].subject&&typeof d[0].subject=="string"){c.subject=d[0].subject}if(d&&d[0]&&d[0].message&&typeof d[0].message=="string"){c.message=d[0].message}if(d&&d[0]&&d[0].token&&typeof d[0].token=="string"){c.token=d[0].token}if(d&&d[0]&&d[0].image&&typeof d[0].image=="string"){c.image=d[0].image
}c=Phx.Util.encodeValues(c);if(d[0].recipients){var f=this._getEncodedRecipientString(d[0].recipients,e);c+=f}gadgets.models.main.getSuggestDialog(e,c)};b.basic.prototype._vcardUpdated=function(d,c){if(typeof d==="function"){d(c)}return};b.basic.prototype.getAdTag=function(c,d,f){var e="&gadgetId="+d.aid+"&adCode="+c[0].adCode;
Phx.Application.RequestRegistry.append({1:"Gadgets_getAdTag",2:function(g){if(typeof f==="function"){f(g.module.data.adTag)}},3:"",4:e})};b.basic.prototype.updateVcard=function(c,d,e){if(gadgets.sandbox){if(typeof e==="function"){alert("Vcard edited");b.basic.prototype._vcardUpdated(e,true)}return}Phx.Application.Modules.vcard.showConnectVcardForm(d.aid,d.title,c[0].requiredFields,function(f){b.basic.prototype._vcardUpdated(e,f)
})};b.basic.prototype.setHeight=function(c,d,e){if(c[0]<this.maxHeight){$("#remote-iframe-"+d.mid).height(c[0])}else{$("#remote-iframe-"+d.mid).height(this.maxHeight)}};b.basic.prototype.setPref=function(c,d,e){if(d.owner!=d.viewer){return}d.prefs[c[1]]=c[2];gadgets.models.main.savePreferences(d.mid,JSON.stringify(d.prefs),function(f){$("#gadgets-gadget-prefs-"+d.mid+" form").replace(f.module.data.html)
})};b.basic.prototype.setTitle=function(c,d,e){$("#gadgets-gadget-title-"+d.mid).text(c[0])};b.basic.prototype.invite=function(c,d,e){this.suggest(c,d,e)};b.basic.prototype.uniqueToken=function(c,d,e){Phx.AJAX.callproxy("Gadgets_CreateUniqueToken",function(f){if(typeof e==="function"){e(f.module.data.token)
}},"","","POST")};b.basic.prototype.install=function(d,e,f){var c={0:"preview",1:d[0]};this.requestNavigateTo(c,e,f)};b.basic.prototype.requestNavigateTo=function(e,h,i){var d;if((d=this._buildUrlForView(e[0],e[1],h))){if(d.type==="popup"){var f=602;var c=413;if(e[3]){if(e[3].width){f=e[3].width}if(e[3].height){c=e[3].height
}}if(gadgets.sandbox){c+=77;Phx.Application.Modules.popuplinks.openWindow(d.url,f,c)}else{Phx.Application.Modules.popuplinks.openWindow(d.url,f,c)}}else{if(h.view==="popup"||h.view==="popupinstallation"){var g=window.opener;document.domain.domain=g.domain;g.window.location.href=d.url;g.focus();if(d.close===true){window.close()
}}else{window.location.href=d.url}}}else{throw Error("UNSUPPORTED VIEW")}};b.canvas=function(){this.maxHeight=2000;b.basic.call(this);this.setHeight=function(c,d,e){if(d.changeSize){this.maxHeight=2000}if(c[0]<this.maxHeight){$("#remote-iframe-"+d.mid).height(c[0])}else{$("#remote-iframe-"+d.mid).height(this.maxHeight)
}}};b.canvas.inherits(b.basic);b.mobilecanvas=function(){b.basic.call(this)};b.mobilecanvas.inherits(b.basic);b.groupcanvas=function(){b.canvas.call(this)};b.groupcanvas.inherits(b.canvas);b.groupcanvasinstallation=function(){b.canvas.call(this)};b.groupcanvasinstallation.inherits(b.canvas);b.group=function(){this.maxHeight=400;
b.basic.call(this)};b.group.inherits(b.basic);b.groupinstallation=function(){b.basic.call(this)};b.groupinstallation.inherits(b.group);b.popup=function(){this.maxHeight=2000;this.setHeight=function(c,d,e){if(d.changeSize){this.maxHeight=2000}if(c[0]<this.maxHeight){$("#remote-iframe-"+d.mid).height(c[0])
}else{$("#remote-iframe-"+d.mid).height(this.maxHeight)}};b.basic.call(this)};b.popup.inherits(b.basic);b.popupinstallation=function(){b.popup.call(this)};b.popupinstallation.inherits(b.popup);b.integration=function(){this.maxHeight=60000;b.basic.call(this);this.setHeight=function(c,d,e){if(d.changeSize){this.maxHeight=60000
}if(c[0]<this.maxHeight){$("#remote-iframe-"+d.mid).height(c[0])}else{$("#remote-iframe-"+d.mid).height(this.maxHeight)}}};b.integration.inherits(b.basic);b.integrationinstallation=function(){b.basic.call(this)};b.integrationinstallation.inherits(b.integration);b.preview=function(){this.maxHeight=400;
b.basic.call(this)};b.preview.inherits(b.basic);b.embedprovider=function(){this.maxHeight=200;b.basic.call(this)};b.embedprovider.inherits(b.basic);b.embed=function(){this.maxHeight=200;b.basic.call(this)};b.embed.inherits(b.basic);b.profile=function(){this.maxHeight=400;b.basic.call(this)};b.profile.inherits(b.basic);
b.nobleprofile=function(){this.maxHeight=2000;b.basic.call(this);this.setHeight=function(c,d,e){if(d.changeSize){this.maxHeight=2000}if(c[0]<this.maxHeight){$("#remote-iframe-"+d.mid).height(c[0])}else{$("#remote-iframe-"+d.mid).height(this.maxHeight)}}};b.nobleprofile.inherits(b.basic);b.nobleprofilecanvas=function(){this.maxHeight=2000;
b.basic.call(this);this.setHeight=function(c,d,e){if(d.changeSize){this.maxHeight=2000}if(c[0]<this.maxHeight){$("#remote-iframe-"+d.mid).height(c[0])}else{$("#remote-iframe-"+d.mid).height(this.maxHeight)}}};b.nobleprofilecanvas.inherits(b.canvas);b.basic.prototype.postBadge=function(d,f,h){var e=d[0].userId;
if(e==="VIEWER"){e=f.vw}else{if(e==="OWNER"){e=f.o}}var c=d[0];var g="&installationId="+f.mid+"&gadgetId="+f.aid+"&badgeUri="+encodeURIComponent(c.badgeUri)+"&badgeTitle="+encodeURIComponent(c.badgeTitle)+"&badgeDescription="+encodeURIComponent(c.badgeDescription)+"&link="+encodeURIComponent(c.link);
Phx.Application.RequestRegistry.append({1:"Badges_postBadge",2:function(i){h(i.module.data.badgeId)},3:"",4:g})};return{get:function(c){if(a[c]){return a[c]}else{return(a[c]=new b[c]())}}}};gadgets.gadgetManager=(function(a){var d=a;var b={};var c=function(e){if(!b[e]){b[e]=e.substring(e.lastIndexOf("-")+1)||false
}return b[e]};return{getGadgetById:function(e){if(isNaN(e)){if(e.indexOf("remote")>-1){e="inst"+c(e)}return d[e]}else{return d["inst"+e]}},setGadgetById:function(f,e){d["inst"+f]=e},setAllGadgets:function(e){d=e},getAllGadgets:function(){return d},deleteGadgetById:function(e){delete d["inst"+e]}}}(gadgets.data));
gadgets.models={};gadgets.models.main={savePreferences:function(d,c,a){var f=gadgets.gadgetManager.getGadgetById(d);if(f.groupId){var e="&groupId="+f.groupId}else{if(f.profileId){var e="&profileId="+f.profileId}else{var e=""}}var b=(f.view=="canvas")?1:0;Phx.AJAX.callproxy("Gadgets_GadgetPrefs",function(g){if(a){a(g)
}Phx.Application.Modules.gadgetscontroller.bindPrefsMenue(f.mid)},"","&pref="+c+"&installationId="+d+e+"&canvas="+b,"POST")},uninstallGadget:function(c,a){var b="";if(a){b="&removeConsumerConnection=1"}Phx.AJAX.callproxy("Gadgets_GadgetUninstall",Phx.Util.createDelegate(function(f){gadgets.gadgetManager.deleteGadgetById(f);
var e=$("#MyGadgetGalleryContainer");if(e.length===0){$(".gadgets-gadget-chrome").remove();return}$("#MyGadgetGalleryContainer").html("");$(".gadgets-gallerylist-item-"+f).remove();Phx.Application.Modules.gadgetsmygallery.removeItem(f);var d=$("#Mod-Gadgets-MyGallery-Count");if(d.length===0){return}d.html(parseInt(d.html())-1)
},this,c),"","&installationId="+c+b,"POST")},form2object:function(b){var a=$(b).serialize();var d=a.split("&");var c={};$.each(d,function(e,f){var g=f.split("=");c[g[0]]=g[1]});return c},getVcard:function(a,b){Phx.AJAX.callproxy("Gadgets_getVcardInformation",function(c){b(c)},"","&gadgetId="+a,"POST")
},getSuggestDialog:function(d,b){var c={};var a=b||{};if(!gadgets.sandbox){if(d.groupId){c.type="GroupGadget";c.id=d.groupId}else{if(d.profileId){c.type="Gadget";c.id=d.profileId}else{return}}}else{c.sandbox="1";c.gadgetRevisionId=d.v}c.gadgetInstallation=d.mid;c.gadgetId=d.aid;c="&"+Phx.Util.encodeValues(c);
if(b){c+="&"+a}Phx.Application.RequestRegistry.append({1:"Gadgets_getSuggestForm",2:function(e){var f=Phx.UI.Dialog.HTML(i18n.getText("link_head"),{message:'<div id="Mod-Suggest2" class="obj-box">'+e.module.data.html+"</div>"});f.show();Phx.Application.Modules.LinkForm.init()},3:"",4:c})},getUninstallDialog:function(a){Phx.Application.RequestRegistry.append({1:"Gadgets_uninstallDialog",2:function(b){if(b.module.data.error){return
}var c=Phx.UI.Dialog.HTML(i18n.getText("gadgets_uninstall_title"),{message:b.module.data.html});c.show();$("#link-gadget-delete-submit").unbind("click.uninstall").bind("click.uninstall",function(){var d=true;if($("#remove-consumer-connection").length>0){d=$("#remove-consumer-connection")[0].checked}gadgets.models.main.uninstallGadget(a,d);
c.close()})},3:"",4:"&installationId="+a})}};gadgets.view=function(){this.togglePrefVisibility=function(a){if($("#gadgets-gadget-prefs-"+a).is(":visible")){$("#gadgets-gadget-prefs-"+a).hide();$("#gadgets-gadget-title-bar-"+a).show()}else{$("#gadgets-gadget-prefs-"+a).show();$("#gadgets-gadget-settings-"+a).hide();
$("#gadgets-gadget-title-bar-"+a).hide()}};this.toggleSettingsVisibility=function(a){if($("#gadgets-gadget-settings-"+a).is(":visible")){$("#gadgets-gadget-settings-"+a).hide();$("#gadgets-gadget-title-bar-"+a).show()}else{$("#gadgets-gadget-settings-"+a).show();$("#gadgets-gadget-prefs-"+a).hide();$("#gadgets-gadget-title-bar-"+a).hide()
}};this.toggleGadgetVisibility=function(a){if($("#gadgets-gadget-content-"+a).is(":visible")){$("#gadgets-gadget-content-"+a).addClass("hidden");this.toggleMinMaxIcon(a,true)}else{$("#gadgets-gadget-content-"+a).removeClass("hidden");this.toggleMinMaxIcon(a,false)}};this.toggleMinMaxIcon=function(b,a){if(a){$("#gadget-collapse-"+b).attr("class","window-controls-expand")
}else{$("#gadget-collapse-"+b).attr("class","window-controls-collapse")}}};Phx.namespace("Phx.Application.Modules.gadgetscontroller",new function(){var e=new gadgets.view();var h=new gadgets.remoteServiceFactory();var i=function(m,l,k){var o=gadgets.gadgetManager.getGadgetById(k.f);var j=h.get(o.view);
if("function"===typeof j[m]){var n=j[m](l,o,k.callback)}};this.generateGadgets=function(){var j=gadgets.gadgetManager.getAllGadgets();for(var k in j){if(j[k].generated){continue}j[k].generated=true;if(j[k].viewer===j[k].owner){j[k].prefs=gadgets.models.main.form2object("#gadgets-gadget-prefs-"+j[k].mid+" form")
}a(j[k]);gadgets.rpc.setAuthToken("remote-iframe-"+j[k].mid,gadgets.rpctoken);gadgets.rpc.setRelayUrl("remote-iframe-"+j[k].mid,gadgets.shindigUrl+"/gadgets/files/container/rpc_relay.html",false);$("<iframe "+j[k].frameParams+' src="about:blank" />').appendTo("#gadgets-gadget-content-"+j[k].mid);var l=document.getElementById("remote-iframe-"+j[k].mid);
l.contentWindow.location.replace(j[k].iframeUrl+"&rpctoken="+gadgets.rpctoken)}};var a=function(j){if(gadgets.sandbox){return}switch(j.view){case"canvas":case"embedprovider":case"popup":case"popupinstallation":case"integration":case"integrationinstallation":case"nobleprofilecanvas":case"groupcanvas":case"groupcanvasinstallation":Phx.Application.Modules.gadgetscontroller.trackGadgetView(j);
break;case"group":$("#gadgets-gadget-content-"+j.mid).unbind("mouseover").bind("mouseover",function(){$(this).unbind("mouseover");window.setTimeout(function(){if(typeof(gadgets.gadgetManager.getGadgetById(j.mid))!=="undefined"){Phx.Application.Modules.gadgetscontroller.trackGadgetView(j)}},10*1000)});
break;case"profile":if(j.viewer===j.owner){$("#gadgets-gadget-content-"+j.mid).unbind("mouseover").bind("mouseover",function(){$(this).unbind("mouseover");window.setTimeout(function(){if(typeof(gadgets.gadgetManager.getGadgetById(j.mid))!=="undefined"){Phx.Application.Modules.gadgetscontroller.trackGadgetView(j)
}},10*1000)})}break;default:break}};var c=function(){var j=$("#Mod-Gadgets-Overview-Featured-One .gadgets-gadget-chrome");if(j.length===0){return}j.unbind("click").bind("click",function(l){Phx.Event.stop(l);var k=$("#Mod-Gadgets-Overview-Featured-One a");if(k.length===0){return}window.location.href=k.attr("href")
})};this.bindGui=function(){var j=gadgets.gadgetManager.getAllGadgets();for(var l in j){var k=j[l].mid;this.bindPrefsMenue(k);this.bindVcardInformation(j[l]);this.bindNavigationLinks(j[l]);this.bindSuggestLink(j[l]);if(gadgets.sandbox){$("#gadgets-gadget-install-"+j[l].mid).unbind("click").bind("click",function(m){Phx.Event.stop(m)
});$("#gadgets-gadget-uninstall-"+j[l].mid).unbind("click").bind("click",function(m){Phx.Event.stop(m)});continue}$("#gadgets-gadget-uninstall-"+j[l].mid).unbind("click").bind("click",Phx.Util.createDelegate(function(m,n){Phx.Event.stop(n);gadgets.models.main.getUninstallDialog(m)},this,k))}};this.bindNavigationLinks=function(m){var j=h.get(m.view);
var l=$("#gadget-navigation-"+m.mid);if(l.length===0){return}var k=j._buildUrlForView(l.attr("name"),m["view-params"],m);l.attr("href",k.url);l.unbind("click").bind("click",Phx.Util.createDelegate(function(n){j.requestNavigateTo([l.attr("name"),n["view-params"]],n,null)},this,m))};this.bindVcardInformation=d;
function d(j){$("#gadget-vcard-link-"+j.mid).unbind("click").bind("click",Phx.Util.createDelegate(function(k){$("#gadget-vcard-link-"+k.mid).unbind("click");gadgets.models.main.getVcard(k.aid,function(l){_dialog=Phx.UI.Dialog.HTML(i18n.getPText("vcard_dialog_headline"),{message:l.module.data.html});_dialog.show();
d(k);Phx.Application.Modules.Accordion.init();$("#Vcard-Information-Close-Link").unbind("click").bind("click",function(){_dialog.close()})})},this,j))}this.bindPrefsMenue=function(j){$("#gadgets-gadget-prefs-"+j+" input[name=submit]").unbind("click").bind("click",Phx.Util.createDelegate(function(k,m){m.preventDefault();
Phx.Event.stop(m);var l=gadgets.models.main.form2object("#gadgets-gadget-prefs-"+j+" form");gadgets.models.main.savePreferences(k,JSON.stringify(l),function(n){var o=gadgets.gadgetManager.getGadgetById(n.module.data.gadget.mid);$("#remote-iframe-"+n.module.data.gadget.mid).attr({src:n.module.data.gadget.iframeUrl+"&view-params="+o["view-params"]+"&rpctoken="+gadgets.rpctoken})
})},this,j));$("#gadgets-gadget-prefs-"+j+" .form-buttons a").unbind("click").bind("click",Phx.Util.createDelegate(function(k){e.togglePrefVisibility(k)},this,j));$("#settings-gadget-"+j).unbind("click").bind("click",Phx.Util.createDelegate(function(k){e.toggleSettingsVisibility(k)},this,j));$("#prefs-gadget-"+j).unbind("click").bind("click",Phx.Util.createDelegate(function(k){e.togglePrefVisibility(k)
},this,j))};this.bindSuggestLink=function(j){$("#tell-gadget-"+j.mid).unbind("click").bind("click",function(k){Phx.Event.stop(k);gadgets.models.main.getSuggestDialog(j)})};var f=false;var g=function(){f=false;var k=gadgets.gadgetManager.getAllGadgets();if(typeof(Phx.Application.Modules.Chat)!=="undefined"&&Phx.Application.Modules.Chat!=null&&typeof(Phx.Application.Modules.Chat.CommunicationService)!=="undefined"&&Phx.Application.Modules.Chat.CommunicationService!=null){Phx.Application.Modules.Chat.CommunicationService.triggerUserInteraction()
}for(var l in k){var j="0";if(gadgets.sandbox){j="1"}Phx.AJAX.callproxy("Gadgets_GetSecurityToken",function(m){k[m.module.data.installation].st=m.module.data.st;gadgets.rpc.call("remote-iframe-"+k[m.module.data.installation].mid,"update_security_token",null,m.module.data.st);if(f===false){f=true;Phx.Application.Modules.gadgetscontroller.initSecurityTokenUpdate()
}},"","&installation="+l+"&gadgetRevision="+k[l].v+"&sandbox="+j+"&st="+encodeURIComponent(k[l].st),"POST")}};this.initSecurityTokenUpdate=function(){window.setTimeout(g,5*60*1000)};this.initPubSub=function(){gadgets.pubsubrouter.init(function(k){var j=gadgets.gadgetManager.getGadgetById(k);return j.iframeUrl
},{onSubscribe:function(j,k){return false},onUnsubscribe:function(j,k){return false},onPublish:function(j,l,k){return false}})};this.trackGadgetView=function(l){if(gadgets.sandbox||window.location.host.indexOf("svz-pc")>0){return}var k=window.location.host.replace("www.","");var j="http://t."+k+"/view?";
j+="t="+(new Date()).valueOf();j+="&aid="+l.aid;j+="&userid="+l.viewer;j+="&view="+l.view;j+="&efr="+l.profileId;Phx.Util.getScriptAsync(j)};var b=function(k){var p=new Array(k.length);var o=0;var r=this.callback;var l=function(t,j){j({})};for(var n=0;n<k.length;n++){var q=osapi;if(k[n].method.indexOf("_")==-1){var s=k[n].method.split(".");
for(var m=0;m<s.length;m++){if(q.hasOwnProperty(s[m])){q=q[s[m]]}else{q=l;break}}}else{q=l}q(k[n].params,function(j){return function(t){p[j]={id:k[j].id,data:t};o++;if(o==k.length){r(p)}}}(n))}};this.init=function(){if(!gadgets||!gadgets.rpc){return}gadgets.rpc.register("resize_oembediframe",function(j,k){var l="#oembed-ifr-"+parseInt(this.f);
$(l).attr("height",parseInt(j));if(k!==null){$(l).attr("width",parseInt(k))}});gadgets.rpc.register("resize_iframe",function(){i("setHeight",arguments,this)});gadgets.rpc.register("set_pref",function(){i("setPref",arguments,this)});gadgets.rpc.register("set_title",function(){i("setTitle",arguments,this)
});gadgets.rpc.register("requestNavigateTo",function(){i("requestNavigateTo",arguments,this)});gadgets.rpc.register("invite",function(){i("invite",arguments,this)});gadgets.rpc.register("uniqueToken",function(){i("uniqueToken",arguments,this)});gadgets.rpc.register("install",function(){i("install",arguments,this)
});gadgets.rpc.register("suggest",function(){i("suggest",arguments,this)});gadgets.rpc.register("updateVcard",function(){i("updateVcard",arguments,this)});gadgets.rpc.register("getAdTag",function(){i("getAdTag",arguments,this)});gadgets.rpc.register("sendEmbed",function(){i("sendEmbed",arguments,this)
});gadgets.rpc.register("sendPrivateMessage",function(){i("sendPrivateMessage",arguments,this)});gadgets.rpc.register("sendPublicMessage",function(){i("sendPublicMessage",arguments,this)});gadgets.rpc.register("getEmbedUrl",function(){i("getEmbedUrl",arguments,this)});gadgets.rpc.register("getStaticContentUrl",function(){i("getStaticContentUrl",arguments,this)
});gadgets.rpc.register("getStaticContent",function(){i("getStaticContent",arguments,this)});gadgets.rpc.register("getPaymentInterstitial",function(){i("showPaymentInterstitial",arguments,this)});gadgets.rpc.register("writeFeedEntry",function(){i("writeFeedEntry",arguments,this)});gadgets.rpc.register("getPermissions",function(){i("getPermissions",arguments,this)
});gadgets.rpc.register("postBadge",function(){i("postBadge",arguments,this)});gadgets.rpc.register("updatePerson",function(){i("updatePerson",arguments,this)});gadgets.rpc.register("osapi._handleGadgetRpcMethod",b);this.generateGadgets();this.bindGui();c();this.bindPrefsMenue();this.initSecurityTokenUpdate();
this.initPubSub()}}());Phx.namespace("Phx.Application.Modules.ManageFriendInvitations",new function(){this.init=function(){};this.showInviteFriendsDialog=function(k,l,o,r){var p=Phx.UI.Dialog.HTML(i18n.getPText("vcard_invite_dialog_title",l),{message:k.module.data.html});p.show();_friends=[].concat(k.module.data.friends);
for(var n=0;n<_friends.length;n++){_friends[n].html=g;_friends[n].styleClass=h}_friends.sort(c);_searchedFriends=[].concat(_friends);_leftContainer=$("#SelectFriends_LeftContainer").longlist({renderType:"ul",elements:_searchedFriends,width:210,count:5,elementHeight:50,elementHeightDiff:5,showMatches:true});
_selectedFriends=[];_rightContainer=$("#SelectFriends_RightContainer").longlist({renderType:"ul",elements:_selectedFriends,width:210,count:5,elementHeight:50,elementHeightDiff:5,showMatches:false});_leftContainer.bind("itemclick",function(s,t){if(t.element.selected){t.element.selected=0;t.htmlElement.removeClass("selected");
d()}else{t.element.selected=1;t.htmlElement.addClass("selected");d(true)}});_leftContainer.bind("itemdblclick",function(s,t){t.element.selected=1;e(_friends,t.element);e(_searchedFriends,t.element);_selectedFriends.push(t.element);_selectedFriends.sort(c);_rightContainer.refresh(true);_leftContainer.refresh(true);
b(true);d(false);a()});_rightContainer.bind("itemclick",function(s,t){if(t.element.selected){t.element.selected=0;t.htmlElement.removeClass("selected");b()}else{t.element.selected=1;t.htmlElement.addClass("selected");b(true)}});_rightContainer.bind("itemdblclick",function(s,t){t.element.selected=1;e(_selectedFriends,t.element);
_friends.push(t.element);_friends.sort(c);_rightContainer.refresh(true);j();b();a()});$("#btnAddFriendToInvitationList").unbind("click").bind("click",i);$("#btnRemoveFriendFromInvitationList").unbind("click").bind("click",f);$("#search-field").unbind("keypress").bind("keyup change blur",j);var m=$("#ManageFriends-Save");
if(m.length>0){m.unbind("click.vcard").bind("click.vcard",function(){if(_selectedFriends.length<=0){return}var t=[];for(var s=0;s<_selectedFriends.length;s++){t.push(_selectedFriends[s].ids)}$().trigger("OmnitureTracking",{abTest:"inviteFriendChooserSuccess"});r(t.join("&friendIdList[]="),o);p.close()
})}var q=$("#ManageFriends-Cancel");if(q.length>0){q.unbind("click.vcard").bind("click.vcard",function(){$().trigger("OmnitureTracking",{abTest:"inviteFriendChooserAbort"});p.close()})}};var g=function(o,k,p){var n=o.name.escapeHtml();if(p.options().showMatches){var l=$("#search-field").val().toLowerCase().escapeHtml();
if(l.length>0){var q="";while(true){var m=n.toLowerCase().indexOf(l);if(m<0){q+=n;break}q+=n.substring(0,m);q+='<span class="match">'+n.substring(m,m+l.length)+"</span>";n=n.substring(m+l.length)}n=q}}return'<span class="pictureframe"><img alt="" src="'+o.imagePath+'"/></span><span class="name ellipsis">'+n+'</span><span class="uniName ellipsis">'+o.uniName.escapeHtml()+"</span>"
};var h=function(l,k){if(l.selected){return"selected"}else{return""}};var d=function(l){if(l===true){$("#btnAddFriendToInvitationList").addClass("enabled").removeClass("disabled");return}if(l===false){$("#btnAddFriendToInvitationList").addClass("disabled").removeClass("enabled");return}for(var k=0;k<_searchedFriends.length;
k++){if(_searchedFriends[k].selected){$("#btnAddFriendToInvitationList").addClass("enabled").removeClass("disabled");return}}$("#btnAddFriendToInvitationList").addClass("disabled").removeClass("enabled")};var b=function(l){if(l===true){$("#btnRemoveFriendFromInvitationList").addClass("enabled").removeClass("disabled");
return}if(l===false){$("#btnRemoveFriendFromInvitationList").addClass("disabled").removeClass("enabled");return}for(var k=0;k<_selectedFriends.length;k++){if(_selectedFriends[k].selected){$("#btnRemoveFriendFromInvitationList").addClass("enabled").removeClass("disabled");return}}$("#btnRemoveFriendFromInvitationList").addClass("disabled").removeClass("enabled")
};var c=function(l,k){var n=l.name.toLowerCase();var m=k.name.toLowerCase();if(n<m){return -1}else{if(m<n){return 1}else{return 0}}};var j=function(){var k=$("#search-field").val().toLowerCase();_searchedFriends.splice(0,_searchedFriends.length);for(var l=0;l<_friends.length;l++){if(k.length===0){_searchedFriends.push(_friends[l])
}else{if(_friends[l].name.toLowerCase().indexOf(k)>=0){_searchedFriends.push(_friends[l])}}}_leftContainer.refresh(true);d()};var e=function(m,l){for(var k=0;k<m.length;k++){if(m[k].ids===l.ids){m.splice(k,1);return}}};var i=function(){var k;var l=false;for(k=0;k<_searchedFriends.length;k++){if(_searchedFriends[k].selected){e(_friends,_searchedFriends[k]);
_selectedFriends.push(_searchedFriends[k]);_searchedFriends.splice(k,1);l=true;k--}}_selectedFriends.sort(c);_leftContainer.refresh(true);_rightContainer.refresh(true);d(false);b(l?true:null);a()};var f=function(){var k;for(k=0;k<_selectedFriends.length;k++){if(_selectedFriends[k].selected){_friends.push(_selectedFriends[k]);
_selectedFriends.splice(k,1);k--}}_friends.sort(c);j();_rightContainer.refresh(true);b(false);a()};var a=function(){if(_selectedFriends.length>0){$("#ManageFriends-Save").removeClass("button-disabled")}else{$("#ManageFriends-Save").addClass("button-disabled")}}}());Phx.namespace("Phx.Application.Modules.vcard",new function(){var d=null;
var x,e,w,c,b,r;var m=function(B,C,D,A){if(!B){return}if(!A){A="Vcard"}Phx.Application.RequestRegistry.append({1:A+"_"+B,2:((typeof D!=="function")?function(){}:D),3:"",4:C})};var f=function(){if(d==null||d.length===0){return}d.close();d=null};var n=function(A){m("getLegalDialog","",function(B){y(B,A)
})};this.getLegalDialog=function(A){n(A)};var y=function(B,A){d=Phx.UI.Dialog.HTML(i18n.getPText("vcard_dialog_legal_headline"),{message:B.module.data.html});d.show();var C=$("#Vcard-LegalDialog-Submit");C.unbind("click.vcard").bind("click.vcard",function(){d.close();A()})};var q=function(){var B="";
var A=$("#Mod-Vcard-LegalHint");if(A.length!==0){n(function(){m("getVcardForm",B,l)});return}m("getVcardForm",B,l)};this.showEmptyVcardForm=function(A,C,B){if(B===true){n(function(){m("getVcardForm","&consumerName="+A,l,C)});return}m("getVcardForm","&consumerName="+A,l,C)};this.showConnectVcardForm=function(B,D,C,A){var F=function(G){d=Phx.UI.Dialog.HTML(i18n.getPText("vcard_dialog_headline"),{message:"<p>"+i18n.getText("app_vcard_newdata",D)+'</p><div class="obj-box vcard-connect-dialog">'+G.module.data.html+"</div>"});
d.show();Phx.Application.Modules.VcardNew.bindGetVcardData();Phx.Application.Modules.VcardNew.bindImportProfileData();$("form#Mod-Vcard-Connect-Form").bind("formSuccess",function(){d.close();A(true)});$("form#Mod-Vcard-Connect-Form").bind("submit",Phx.Application.Modules.Forms.bindAjaxForms);$("form#Mod-Vcard-Connect-Form .form-buttons a").click(function(H){Phx.Event.stop(H);
d.close();A(false)})};var E="Gadgets";if(C){C=encodeURIComponent(C.join(","));m("getVcardForm","&gadgetId="+B+"&requiredFields="+C,F,E);return}m("getVcardForm","&gadgetId="+B,F,E)};this.showVcardForm=function(B,A){m("getVcardForm","&vcardId="+B,l,A)};var t=function(){var C=$("input[name=currentVcardId]",$(this).parent());
if(C.length===0){return}var B=C.val();var A="&vcardId="+B;m("getVcardForm",A,l)};var l=function(A){d=Phx.UI.Dialog.HTML(i18n.getPText("vcard_dialog_headline"),{message:A.module.data.html});d.show();$("#vcard-edit-cancel-button").unbind("click.cancel").bind("click.cancel",function(){d.close()});if(!$.browser.msie){$("#PhxCover").css({height:"100%",position:"fixed"})
}Phx.Application.Modules.EditVcard.initBindings();Phx.Application.Modules.Accordion.init()};var g=function(B,A){window.location.href="/Account/ConnectedServices"};var i=function(){var A=$("#vcard-new-link");if(A.length===0){return}A.unbind("click.vcard").bind("click.vcard",v)};var z=function(){$("ul.vcardList select").unbind("change").bind("change",function(){var C=$(this);
var B=C.siblings("input.consumerId").val();var A=C.val();k(A,B,C.attr("id"))});$("select#vcard-edit-general").unbind("change").bind("change",function(A){})};var k=function(A,B,C){var D="&vcardId="+A+"&consumerId="+B;m("changeVcard",D,function(){$('#vcard-edit-general option[value="'+A+'"]').addClass("connected");
var E=true;$("ul.vcardList select").each(function(F,G){if($(G).val()==r){E=false;return}});if(E===true){$('#vcard-edit-general option[value="'+r+'"]').removeClass("connected");u()}p()})};var a=function(){var A=$("#preseletced-vcardId").val();if(A){$("#vcard-edit-general option[value="+A+"]").attr("selected","selected");
q(A)}};var p=function(){var A=$("#vcard-edit-general").val();var B=$('#vcard-edit-general option[value="'+A+'"]');var C=B.hasClass("connected");if(C===false){$("#delete-vcard").unbind("click").bind("click",function(){s(A)}).removeClass("hidden")}else{$("#delete-vcard").addClass("hidden").unbind("click")
}};var s=function(A){var C=$('#vcard-edit-general option[value="'+A+'"]');var D="&vcardId="+A;var B=Phx.UI.Dialog.ButtonDialog(i18n.getPText("vcard_delete_head"),{message:i18n.getPText("vcard_delete_confirm",C.html()),buttons:[new Phx.UI.Button.Submit(i18n.getPText("vcard_delete_submit"),true),new Phx.UI.Button.Cancel(i18n.getPText("dialogbutton_cancel_svz"),false)],events:{onButtonClicked:function(E){if("false"===E||false===E){return
}m("deleteVcard",D,function(F){C.remove();window.location.href="/Account/ConnectedServices"})}}});B.show()};var u=function(){$("#Vcard-MyServices ul select").unbind("focus").bind("focus",function(){r=$(this).val()})};var j=function(){$("ul.obj-thumbnaillist>li").tooltip({bodyHandler:function(){return $(this).html()
},showURL:false,delay:0,track:true})};var o=function(){var A=$("#vcard-edit-general option:selected").val();var B=$("#edit-vcard-container");var C=$("#vcard-consumer-list");if(A==0){$("#vcard-new-link").parent().removeClass("hidden")}else{$("#vcard-new-link").parent().addClass("hidden")}$("#vcard-edit-general").unbind("change.editVcard").bind("change.editVcard",function(){A=$("#vcard-edit-general option:selected").val();
p();if(A==0){B.html("");C.show();$("#vcard-new-link").parent().removeClass("hidden")}else{if(A!=0){q(A);$("#vcard-new-link").parent("li").addClass("hidden")}}})};var q=function(A){var B=$("#edit-vcard-container");var C=$("#vcard-consumer-list");Phx.AJAX.call("Vcard_getVcardForm",function(D){C.hide();
B.html(D.module.data.html);Phx.Application.Modules.EditVcard.init();h();j();Phx.Application.Modules.Accordion.init();$("#vcard-edit-cancel-button").unbind("click.cancel").bind("click.cancel",function(){B.html("");C.show();$("#vcard-edit-general option")[0].selected=true;o();p()})},"","&vcardId="+A)};
var v=function(){var B="";var A=$("#Mod-Vcard-LegalHint");if(A.length!==0){n(function(){m("getVcardForm",B,l)});return}m("getVcardForm",B,l)};var h=function(){var A=$("#show-all-consumer");var B=$("ul.obj-thumbnaillist.sliced");if(A&&B){A.unbind("click.open").bind("click.open",function(){B.toggle()})
}};this.init=function(){u();p();z();i();$(Phx.Application.Modules.EditVcard).bind("submitEditVcardFormSuccessful",g);var B=window.location.hash;if(B.length>1){B=B.substring(1);if(!B.match(/^[a-zA-Z0-9]*$/)){return}var A=$("#invite_"+B);if(A.length>0){$(A).trigger("click")}}o();h();a()}}());Phx.namespace("Phx.Application.Modules.EditVcard",new function(){var c="Account.ConnectedServices";
var i=function(k,l,m){if(!k){return}Phx.Application.RequestRegistry.append({1:"Vcard_"+k,2:((typeof m!=="function")?function(){}:m),3:"",4:l})};var j=function(m){Phx.Event.stop(m);var l=$("#edit-vcard-form");if(l.length===0){return}var k=$("#consumerCards");if(k.length===0||k.val()==""){l.submit();return
}var n=Phx.UI.Dialog.Confirm(i18n.getPText("vcard_dialog_edit_form_hint_headline"),{message:i18n.getPText("vcard_dialog_edit_form_hint_text",k.val()),events:{onButtonClicked:function(o){if("false"===o||false===o){return}l.submit()}}});n.show()};var d=function(){var q=$("#vcard-edit-cancel-button");if(q.length===0){return
}q.unbind("click.vcard").bind("click.vcard",function(){$(Phx.Application.Modules.EditVcard).trigger("cancelEditVcardForm")});var k=$("#needSubmitHint");var p=0;if(k.length>0){p=parseInt(k.val(),10)}if(p){var l=$("#vcard-edit-submit-button");if(l.length===0){return}l.unbind("click.vcard").bind("click.vcard",j)
}var s=$("#edit-vcard-form");if(s.length===0){return}s.unbind("submit.vcard").bind("submit.vcard",Phx.Application.Modules.Forms.bindAjaxForms).bind("formSuccess",function(u,t){$(Phx.Application.Modules.EditVcard).trigger("submitEditVcardFormSuccessful",t)});var r=$("#vcard-edit-getprofile-minimal-button");
var m=$("#vcard-edit-getprofile-contact-button");var o=$("#vcard-edit-getprofile-etc-button");if(r.length!==0){r.unbind("click.vcard").bind("click.vcard",g)}if(m.length!==0){m.unbind("click.vcard").bind("click.vcard",f)}if(o.length!==0){o.unbind("click.vcard").bind("click.vcard",a)}var n=$("#Vcard_publishProfileImage");
if(n.length!==0){n.unbind("click.vcard").bind("click.vcard",function(){var t=$("#Vcard-Image-Message");var u=$("#Vcard-Profile-Image");if(t.length===0||u.length===0){return}if(n.attr("checked")===false){t.show();u.hide()}else{t.hide();u.show()}})}};var g=function(k){Phx.Event.stop(k);i("getProfileData","",h)
};var f=function(k){Phx.Event.stop(k);i("getProfileData","",e)};var a=function(k){Phx.Event.stop(k);i("getProfileData","",b)};var h=function(o){var l=o.module.data.data;var k=["firstname","lastname","gender","birthdayDay","birthdayMonth","birthdayYear"];for(var m in k){if(l[k[m]]==null||l[k[m]].length===0){continue
}var n;if(k[m].toString().substr(0,8)=="birthday"){n=$("#"+k[m])}else{n=$("#Vcard_"+k[m])}if(n.length===0){continue}n.val(l[k[m]])}};var e=function(r){var n=r.module.data.data;var m=["email","phonenumberMobile","phonenumberHome","phonenumberWork","addressStreet","addressZip","addressTown","addressCountry","homepage"];
for(var o in m){if(n[m[o]]==null||n[m[o]].length===0){continue}var q=$("#Vcard_"+m[o]);if(q.length===0){continue}q.val(n[m[o]])}var l=$("#edit-vcard-form");if(l.length===0){return}var k=$(".obj-accordion",l);if(k.length===0){return}var p=$("dd",k);if(p.length===0){return}p.show()};var b=function(r){var n=r.module.data.data;
var m=["school","jobTitle","jobStatus","relationshipStatus"];for(var o in m){if(n[m[o]]==null||n[m[o]].length===0){continue}var q=$("#Vcard_"+m[o]);if(q.length===0){continue}q.val(n[m[o]])}var l=$("#edit-vcard-form");if(l.length===0){return}var k=$(".obj-accordion",l);if(k.length===0){return}var p=$("dd",k);
if(p.length===0){return}p.toggle()};this.init=function(){if(Phx.Application.getBackendPagelet()!=c){return}d()};this.initBindings=function(){d()}}());Phx.namespace("Phx.Application.Modules.VcardNew",new function(){var a=this;this.bindImportProfileData=function(){$("#getprofile").unbind("click.importProfileData").bind("click.importProfileData",function(){var c="00";
var d="00";var b="1111";if($("#profile-birthday").val()){birthday=$("#profile-birthday").val().split("-");c=birthday[2];d=birthday[1];b=birthday[0]}a._setFormData($("#profile-firstname").val(),$("#profile-lastname").val(),$("#profile-gender").val(),c,d,b,$("#profile-email").val(),$("#profile-phone").val(),$("#profile-realAddress").val(),$("#profile-homeZip").val(),$("#profile-homeTown").val(),$("#profile-homeCountry").val())
})};this.bindGetVcardData=function(){var d=$("#Vcard_vcardId");if(d.val()!="0"){$(".link-open-edit-vcard").attr("href","/Account/ConnectedServices/apps/"+d.val()).attr("target","_blank");var c=$("#Vcard_vcardId option:selected").html();$("#Vcard_vcardName").val(c).attr("disabled","disabled")}else{$("#Vcard_vcardName").val(i18n.getText("vcard_dialog_headline")+" "+$("#Vcard_vcardId option").length);
$(".link-open-edit-vcard").attr("href","javascript:;").attr("target","")}d.unbind("change.vcardSelection").bind("change.vcardSelection",function(){var e=$(this).val();if(e!=="0"){$(".link-open-edit-vcard").attr("href","/Account/ConnectedServices/apps/"+e).attr("target","_blank");Phx.AJAX.call("Vcard_getVcardData",function(h){if(h.module.data){var g=h.module.data.birthday.split("-");
var i=g[2];var j=g[1];var f=g[0];a._setFormData(h.module.data.firstName,h.module.data.lastName,h.module.data.gender,i,j,f,h.module.data.email,h.module.data.phone,h.module.data.street,h.module.data.zip,h.module.data.city,h.module.data.country);$("#Vcard_vcardName").val(h.module.data.vcardName).attr("disabled","disabled")
}},null,"&vcardId="+e)}else{if(e=="0"){$("#Vcard_vcardName").val(i18n.getText("vcard_dialog_headline")+" "+$("#Vcard_vcardId option").length).removeAttr("disabled");$(".link-open-edit-vcard").attr("href","javascript:;").attr("target","")}}});var b=$("#Vcard_publishProfileImage");if(b.length!==0){b.unbind("click.vcard").bind("click.vcard",function(){var e=$("#Vcard-Image-Message");
var f=$("#Vcard-Profile-Image");if(e.length===0||f.length===0){return}if(b.attr("checked")===false){e.show();f.hide()}else{e.hide();f.show()}})}};this._setFormData=function(m,n,k,j,e,c,i,g,h,l,b,d){$("#Vcard_firstname").val(m);$("#Vcard_lastname").val(n);var f=3;if(k=="1"){f=0}if(k=="2"){f=1}$($("#Vcard_gender option")[f]).attr("selected","selected");
$("#birthdayDay").val(j);$("#birthdayMonth").val(e);$("#birthdayYear").val(c);$("#Vcard_email").val(i);$("#Vcard_phone").val(g);$("#Vcard_addressStreet").val(h);$("#Vcard_addressZip").val(l);$("#Vcard_addressTown").val(b);$("#Vcard_addressCountry").val(d)};this.init=function(){a.bindImportProfileData();
a.bindGetVcardData()}}());
