/*********************************************** * H&M STUFF ***********************************************/ // Toggle Toggler function toggleToggles(imageItem) { if (unescape(imageItem.src) == unescape(document.getElementById("expandAllImage").src)) { imageItem.src = document.getElementById("collapseAllImage").src; imageItem.alt = document.getElementById("collapseAllImage").alt; document.getElementById("collapseAllLabel").style.display = "inline"; document.getElementById("expandAllLabel").style.display = "none"; HMToggleExpandAll(true); } else { imageItem.src = document.getElementById("expandAllImage").src; imageItem.alt = document.getElementById("expandAllImage").alt; document.getElementById("collapseAllLabel").style.display = "none"; document.getElementById("expandAllLabel").style.display = "inline"; HMToggleExpandAll(false); } } function toggleToggles_CheckKey(imageItem, event) { if(event.keyCode == 13) toggleToggles(imageItem); } /*********************************************** * END H&M STUFF ***********************************************/ /*********************************************** * PAGE INIT ***********************************************/ /** * Splitting the screen */ function SplitScreen (nonScrollingRegionId, scrollingRegionId) { this.nonScrollingRegion = document.getElementById(nonScrollingRegionId); this.scrollingRegion = document.getElementById(scrollingRegionId); document.body.style.margin = "0px"; document.body.style.overflow = "hidden"; this.scrollingRegion.style.overflow = "auto"; this.resize(null); registerEventHandler(window, 'resize', getInstanceDelegate(this, "resize")); // clean itself on document unload registerEventHandler(window, 'unload', getInstanceDelegate(this, "dispose")); } SplitScreen.prototype.resize = function(e) { var scrollRegionHeight = document.body.clientHeight - this.nonScrollingRegion.offsetHeight; if (scrollRegionHeight < 0) { scrollRegionHeight = 0; } this.scrollingRegion.style.height = scrollRegionHeight; this.scrollingRegion.style.width = document.body.clientWidth; } SplitScreen.prototype.dispose = function(e) { try { this.nonScrollingRegion = null; this.scrollingRegion = null; //remove events so if external document is open in window, it will not be affected unregisterEventHandler(window, 'load', init); unregisterEventHandler(window, 'resize', getInstanceDelegate(this, "resize")); unregisterEventHandler(window, 'unload', getInstanceDelegate(this, "dispose")); // This is not neccessary. In IE (6 at least) the "scrolling" attribute from frameset's HTML // is always used when new page is loaded in the frame. document.body.style.overflow = "auto"; document.body.style.height = "100%"; document.body.scroll="yes"; window.frameElement.scrolling = "auto"; } catch (ex) {} } // Event handler attachment function registerEventHandler (element, event, handler) { if (element.attachEvent) { element.attachEvent('on' + event, handler); } else if (element.addEventListener) { element.addEventListener(event, handler, false); } else { element[event] = handler; } } // Event handler detachment function unregisterEventHandler(element, event, handler) { if (typeof element.removeEventListener == "function") element.removeEventListener(event, handler, false); else element.detachEvent("on" + event, handler); } function getInstanceDelegate (obj, methodName) { return( function(e) { e = e || window.event; return obj[methodName](e); } ); } //element manipulation, functions with limited functionality defined not to throw errors on the page //window.onload=init; registerEventHandler(window, 'load', init); function init() { try { fixMoniker(); fixMsdnLinks(); loadLangFilter(); showSelectedLanguages(); var langDropDown = document.getElementById("devlangsDropdown"); var langMenu = document.getElementById("devlangsMenu"); registerEventHandler(langDropDown,'mouseover', showLangFilter); registerEventHandler(langDropDown,'mouseout', hideLangFilter); registerEventHandler(langMenu,'mouseover', showLangFilter); registerEventHandler(langMenu,'mouseout', hideLangFilter); document.getElementById('languageFilterToolTip').style.display = "none"; } catch (e) {} try { document.getElementById('membersOptionsFilterToolTip').style.display = "none"; } catch (e1) {} // split screen try { var screen = new SplitScreen('header', 'mainSection'); } catch (e3) {} } /*********************************************** * END PAGE INIT ***********************************************/ /*********************************************** * LANGUAGE FILTER ***********************************************/ function loadLangFilter() { var inputTags = document.getElementsByTagName("input"); var i; for (i=0; i var code; code = td.innerHTML; code = code.replace(/
/gi, "\n"); code = code.replace(/<\/td>/gi, "\n"); // syntax highlighter removes \n chars and puts each line in separate // get plain text var tmpDiv = document.createElement('div'); tmpDiv.innerHTML = code; if (typeof(tmpDiv.textContent) != "undefined") { // standards compliant code = tmpDiv.textContent; } else if (typeof(tmpDiv.innerText) != "undefined") { // IE only code = tmpDiv.innerText; } try { // works in IE only window.clipboardData.setData("Text", code); } catch (ex) { popCodeWindow(code); } } } catch (e) {} } function CopyCode_CheckKey(spanItem) { if(window.event.keyCode == 13) CopyCode(spanItem); } function popCodeWindow(code) { try { var codeWindow = window.open ("", "Copy the selected code", "location=0,status=0,toolbar=0,menubar =0,directories=0,resizable=1,scrollbars=1,height=400, width=400"); codeWindow.document.writeln(""); codeWindow.document.writeln(""); codeWindow.document.writeln("Copy the selected code"); codeWindow.document.writeln(""); codeWindow.document.writeln(""); codeWindow.document.writeln('
');
		codeWindow.document.writeln(escapeHTML(code));
		codeWindow.document.writeln("
"); codeWindow.document.writeln(""); // the selectNode function below, converted by http://www.howtocreate.co.uk/tutorials/jsexamples/syntax/prepareInline.html var ftn = "function selectNode (node) {\n\tvar selection, range, doc, win;\n\tif ((doc = node.ownerDocument) && \n\t\t(win = doc.defaultView) && \n\t\ttypeof win.getSelection != \'undefined\' && \n\t\ttypeof doc.createRange != \'undefined\' && \n\t\t(selection = window.getSelection()) && \n\t\ttypeof selection.removeAllRanges != \'undefined\') {\n\t\t\t\n\t\trange = doc.createRange();\n\t\trange.selectNode(node);\n selection.removeAllRanges();\n selection.addRange(range);\n\t} else if (document.body && \n\t\t\ttypeof document.body.createTextRange != \'undefined\' && \n\t\t\t(range = document.body.createTextRange())) {\n \n\t\t \trange.moveToElementText(node);\n \trange.select();\n }\n} "; codeWindow.document.writeln(ftn); codeWindow.document.writeln("selectNode(document.getElementById('code_text'));"); codeWindow.document.writeln(""); codeWindow.document.writeln(""); codeWindow.document.close(); } catch (ex) {} } function escapeHTML (str) { return str.replace(/&/g,"&"). replace(/>/g,">"). replace(/ parent of original link var parentSpan = origLinkElement.parentNode; while (parentSpan) { if (parentSpan.className.toLowerCase() == "msdn-link-container") { // parent span found // find HxS link if any var hxLinks = parentSpan.getElementsByTagName("MSHelp:link"); // doesn't work in IE, works in FF if (hxLinks.length == 0) { hxLinks = parentSpan.getElementsByTagName("link"); // doesn't work in FF, works in IE } if (hxLinks.length >= 1) { hxLinks[0].setAttribute("keywords", keyword); hxLinks[0].childNodes[0].nodeValue = origLinkElement.childNodes[0].nodeValue; return true; } break; } parentSpan = parentSpan.parentNode; } } catch (ex) { } return false; } /** * Fixes MSDN keyword for use with redirect.htm in CHM format. */ function escapeKeyword(keyword) { /* Keyword can contain "," characters as parameter delimiter. Keyword resolving engine expects TAB where keyword syntax uses ",". It also expects NEWLINE where keyword syntax uses ";". While HxLink.htc used with in HxS format takes care of it, redirect.htm used in CHM format doesn't. So we must do it. */ var res = keyword; res = res.replace(/,/g, "\t"); res = res.replace(/;/g, "\n"); res = escape(res); return res; } /** * Converts MSDN2 keyword (cref) to MSDN2 web link */ function convertMsdnKeywordToMsdn2Link(keyword) { var res = keyword; // remove prefix res = res.replace(/^.+:(.*)/g, "$1"); // remove parameters res = res.replace(/(.*)\(.*/g, "$1"); res = res.toLowerCase(); res = "http://msdn.microsoft.com/en-us/library/" + res + ".aspx"; return res; } // Highest MSDN version installed. var msdnVersion; /** * Returns highest MSDN version installed. * @return The MSDN version found in format 8.0 or 9.0 or web. If none is found, * the "web" is returned. */ function getHighestMsdnVersion () { var MSDN_9_CSS = "ms-help://MS.VSCC.v90/dv_vscccommon/styles/presentation.css"; var MSDN_8_CSS = "ms-help://MS.VSCC.v80/dv_vscccommon/local/Classic.css"; if (cssFileExists(MSDN_9_CSS)) { return "9.0"; } if (cssFileExists(MSDN_8_CSS)) { return "8.0"; } return "web"; } /** * Tests whether specified CSS url exists. */ function cssFileExists(cssUrl) { var sheet = null var temporary = false res = false; // first detect whether this CSS is already used in this document (it should be) try { var i; for (i=0; i 0) { res = true } } else if (sheet.cssRules) { // FF if (sheet.cssRules.length > 0) { res = true } } } catch (ex) { } return res; } /*********************************************** * END MSDN LINKS FIX ***********************************************/