// Add a fix for code stuff? if ((is_ie && !is_ie4) || is_webkit || is_ff) addLoadEvent(smf_codeBoxFix); // The purpose of this code is to fix the height of overflow: auto blocks, because some browsers can't figure it out for themselves. function smf_codeBoxFix() { var codeFix = document.getElementsByTagName('code'); for (var i = codeFix.length - 1; i >= 0; i--) { if (is_webkit && codeFix[i].offsetHeight < 20) codeFix[i].style.height = (codeFix[i].offsetHeight + 20) + 'px'; else if (is_ff && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0)) codeFix[i].style.overflow = 'scroll'; else if ('currentStyle' in codeFix[i] && codeFix[i].currentStyle.overflow == 'auto' && (codeFix[i].currentStyle.height == '' || codeFix[i].currentStyle.height == 'auto') && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0) && (codeFix[i].offsetHeight != 0)) codeFix[i].style.height = (codeFix[i].offsetHeight + 24) + 'px'; } } // Adds a button to a certain button strip. function smf_addButton(sButtonStripId, bUseImage, oOptions) { var oButtonStrip = document.getElementById(sButtonStripId); var aItems = oButtonStrip.getElementsByTagName('span'); // Remove the 'last' class from the last item. if (aItems.length > 0) { var oLastSpan = aItems[aItems.length - 1]; oLastSpan.className = oLastSpan.className.replace(/\s*last/, 'position_holder'); } // Add the button. var oButtonStripList = oButtonStrip.getElementsByTagName('ul')[0]; var oNewButton = document.createElement('li'); setInnerHTML(oNewButton, '' + oOptions.sText + ''); oButtonStripList.appendChild(oNewButton); } // Adds hover events to list items. Used for a versions of IE that don't support this by default. var smf_addListItemHoverEvents = function() { var cssRule, newSelector; // Add a rule for the list item hover event to every stylesheet. for (var iStyleSheet = 0; iStyleSheet < document.styleSheets.length; iStyleSheet ++) for (var iRule = 0; iRule < document.styleSheets[iStyleSheet].rules.length; iRule ++) { oCssRule = document.styleSheets[iStyleSheet].rules[iRule]; if (oCssRule.selectorText.indexOf('LI:hover') != -1) { sNewSelector = oCssRule.selectorText.replace(/LI:hover/gi, 'LI.iehover'); document.styleSheets[iStyleSheet].addRule(sNewSelector, oCssRule.style.cssText); } } // Now add handling for these hover events. var oListItems = document.getElementsByTagName('LI'); for (oListItem in oListItems) { oListItems[oListItem].onmouseover = function() { this.className += ' iehover'; }; oListItems[oListItem].onmouseout = function() { this.className = this.className.replace(new RegExp(' iehover\\b'), ''); }; } } // Add hover events to list items if the browser requires it. if (is_ie6down && 'attachEvent' in window) window.attachEvent('onload', smf_addListItemHoverEvents);