if (!window.Microsoft) window.Microsoft = {}; if (!Microsoft.Com) Microsoft.Com = {}; if (!Microsoft.Com.Experiences) Microsoft.Com.Experiences = {}; if (!Microsoft.Com.Experiences.Web) Microsoft.Com.Experiences.Web = {}; if (!Microsoft.Com.Experiences.Web.Widgets) Microsoft.Com.Experiences.Web.Widgets = {}; Microsoft.Com.Experiences.Web.Widgets.Bookmark = function() { var index = 1; var divId; var div = 1; while (div != null) { divId = 'CoreJsBaseElement' + index; div = document.getElementById(divId); index++; }; document.write('
'); this.parentDiv = document.getElementById(divId); this.bkText = 'Bookmark on Microsoft TechNet'; this.type = '1'; this.attachAnchor(); this.attachStyleSheet('http://services.social.microsoft.com/Widgets/widgets/bookmarking/bk.css', 'bkstyle'); } Microsoft.Com.Experiences.Web.Widgets.Bookmark.prototype = { attachAnchor : function() { var iconanchor = document.createElement('a'); iconanchor.href = '#'; iconanchor.style.border = 'none'; iconanchor.style.verticalAlign = 'middle'; var onClickFunction = function() { window.open('http://social.technet.microsoft.com/en-US/action/create/s/E/?url=' + encodeURIComponent(location.href) + '&ttl=' + encodeURIComponent(document.title||'') + '&d=' + encodeURIComponent(getSelectedText()), '_blank'); } if (onClickFunction) { iconanchor.onclick = onClickFunction; } var icon = document.createElement('img'); icon.src = 'http://services.social.microsoft.com/Widgets/widgets/bookmarking/images/technet/bookmark.png'; icon.title = this.bkText; icon.style.border = 'none'; icon.style.height = '16px'; icon.style.width = '16px'; iconanchor.appendChild(icon); this.parentDiv.appendChild(iconanchor); if (this.type == '1') { var bkanchor = document.createElement('a'); bkanchor.appendChild(document.createTextNode(this.bkText)); bkanchor.href = '#'; bkanchor.style.verticalAlign = 'middle'; if (onClickFunction) { bkanchor.onclick = onClickFunction; } this.parentDiv.appendChild(document.createTextNode(' ')); this.parentDiv.appendChild(bkanchor); } }, // Attach a Stylesheet to document // attachStyleSheet: function (path, linkId) { var doc = document.getElementsByTagName('head').item(0); var link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = path; link.id = linkId; doc.appendChild(link); return false; } } function getSelectedText() { var value = ''; if (window.getSelection) { value = window.getSelection(); } else if (document.getSelection) { value = document.getSelection(); } else if (document.selection) { value = document.selection.createRange().text; } return value; } var bookmarkWidget = new Microsoft.Com.Experiences.Web.Widgets.Bookmark();