function UserBadge(){var _rootElement=null;var _properties=null;UserBadge.properties;UserBadge.css;UserBadge.prototype.Init=function(root,sData){_properties=sData?sData:UserBadge.properties;if(!_properties||_properties.length<1){return;}if(root==null){_rootElement=CreateRootElement('span','UserBadgeWidget');}else{_rootElement=InsertRootElement('span','UserBadgeWidget',root);}if(UserBadge.css){var styleDiv=document.createElement('div');styleDiv.innerHTML=' ';var root=_rootElement.parentNode;root.insertBefore(styleDiv,_rootElement);}this.Render(_rootElement,_properties);}};function InsertRootElement(tag,id,sibling){if(tag==null){return null;}if(id==null){return;}var instanceNum=0;var element=document.getElementById(tag);while(element!=null){instanceNum++;element=document.getElementById(id+instanceNum.toString());if(element==null){id=id+instanceNum.toString();break;}}element=document.createElement(tag);element.id=id;var parent=sibling.parentNode;parent.insertBefore(element,sibling);if(!sibling.nextSibling){parent.appendChild(element);}else{parent.insertBefore(element,sibling.nextSibling);}return element;};function CreateRootElement(tag,id){if(tag==null){return null;}if(id==null){return;}var instanceNum=0;var element=document.getElementById(id);while(element!=null){instanceNum++;element=document.getElementById(id+instanceNum.toString());if(element==null){id=id+instanceNum.toString();break;}}document.write('<'+tag+' id="'+id+'">');return document.getElementById(id);};function $CAnchor(text,url,cssClass,style,title){var anchor=document.createElement('a');if(url){anchor.href=url;}if(text){anchor.appendChild(document.createTextNode(text));}if(cssClass){anchor.setAttribute('class',cssClass);anchor.setAttribute('className',cssClass);}if(style){anchor.setAttribute('style',style);}if(title){anchor.title=title;}return anchor;};function $CElem(tag,id,cssClass,style,data){var elem=document.createElement(tag);if(id){elem.setAttribute('id',id);}if(cssClass){elem.setAttribute(window.ActiveXObject?'className':'class',cssClass);}if(style){elem.setAttribute('style',style);}if(data){for(var key in data){elem[key]=data[key];}}return elem;};function GetAffilsText(props){var _properties=props;if(!_properties){return '';}var affilsText='';if(_properties['MVP']){affilsText=' - MVP';}if(_properties['MSFT']){if(affilsText==''){affilsText=' - MSFT';}else{affilsText=', MSFT';}}return affilsText;};UserBadge.prototype.Render=function(container,properties){var _properties=properties;var _rootElement=container;var parent=_rootElement;var containerRoot;var child;var contentsContainer;containerRoot=$CElem('div','UserBadgeContainer','UserBadgeContainer',null);parent.appendChild(containerRoot);parent=containerRoot;child=$CElem('div',null,'rTop');child.appendChild($CElem('div',null,'tlc'));child.appendChild($CElem('div',null,'trc'));parent.appendChild(child);child=$CElem('div',null,'contents');parent.appendChild(child);parent=child;contentsContainer=parent;child=$CElem('div',null,'Avatar');parent.appendChild(child);parent=child;child=$CAnchor(null,_properties['profileUrl'],null,null);parent.appendChild(child);parent=child;child=$CElem('img',null,null,null,{src:_properties['avatarImg'],title:_properties['avatarAlt']});parent.appendChild(child);parent=$CElem('div',null,'DisplayNameContainer',null);contentsContainer.appendChild(parent);child=$CElem('span',null,'DisplayName');parent.appendChild(child);parent=child;var displayName=_properties['displayName']+GetAffilsText(_properties);child=$CAnchor(displayName,_properties['profileUrl'],null,null,displayName);try{if(TrackEvent){if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){child.setAttribute('onmousedown',function(){TrackEvent('BadgeSignIn');return true;});}else{child.setAttribute('onmousedown',"TrackEvent('BadgeSignIn');");}}}catch(ex){}parent.appendChild(child);if(_properties['affiliation']){child=$CElem('span','affiliation');child.appendChild(document.createTextNode(_properties['affiliation']));parent.appendChild(child);}if(_properties['medals']&&_properties['medalTitle']&&_properties['medalImage']){var medalCount=parseInt(_properties['medals']);for(var i=0;i<5;i++){child=$CElem('img',null,(i