function consoleClear() { return; //var console = document.getElementById("id1"); //console.innerHTML = ""; //console.style.fontSize = "8px"; //console.style.lineHeight = "10px"; } function consoleWrite(s) { return; //var console = document.getElementById("id1"); //console.innerHTML = console.innerHTML + s + "
"; } function getFontSize(e) { // This works in Safari and FF var size = "1em"; if (!e) return size; // style size if (e.style.fontSize) { size = e.style.fontSize; consoleWrite ("style size"); } else if (e.currentStyle) { //size = e.currentStyle.fontSize; size = "1em"; consoleWrite ("ie size"); } else if (document.defaultView) { style = document.defaultView.getComputedStyle(e, null); if (style) { size = style.getPropertyValue("font-size"); consoleWrite ("ff size"); } } return size; } function getSuffix(s) { return s.substring(s.length-2, s.length); } function resize(e, depth) { if (!e) return; //consoleWrite ("" + depth + e.nodeName + "(" + e.nodeType + "): '" + e.nodeValue + "'"); if (e.nodeType == 1) { fontSizeString = getFontSize(e); fontSize = parseFloat(fontSizeString); suffix = getSuffix(fontSizeString); // Use some magic numbers to compute new values fontSize = fontSize * 0.95; fontSizeString = "" + fontSize + suffix; lineHeightString = "" + fontSize * 1.3 + suffix; e.style.fontSize = fontSizeString; e.style.lineHeight = lineHeightString; } resize(e.firstChild, depth + "- "); resize(e.nextSibling, depth); } function fixBox(id) { consoleClear(); // Set up size variables // These fail quietly so that the resizing will carry on // to other blocks without killing the script var outside = document.getElementById(id + "_outside"); var inside = document.getElementById(id + "_inside"); if (!outside) return; if (!inside) return; var outsideHeight = parseFloat(outside.style.height); var insideHeight = inside.offsetHeight; if (!outsideHeight) return; if (!insideHeight) return; // The main loop var MAXCOUNT = 15; var count = 0; while ((insideHeight > outsideHeight) && (count < MAXCOUNT)) { resize(outside.firstChild, ""); insideHeight = inside.offsetHeight; count++; } } function onPageLoad() { }