window.onload = initialize; function setTop(elementId, newTop) { getStyleReference(elementId).top = newTop; } function showIt(elementId) { getStyleReference(elementId).visibility = "visible"; } function hideIt(elementId) { getStyleReference(elementId).visibility = "hidden"; } function isVisible(elementId) { var vis = getStyleReference(elementId).visibility; return (vis == "visible" || vis == "show"); } //Initial height function determineIframeHeight(numHeadlines, showSection, location) { var desiredHeight=0; /* Sizing Approach: 1) Get total length of first four headlines, in # of chars. 2) Devise a formula to calculate iframe height based on #. 3) If any given headline is >presumed line length # chars, add some constant to account for line wrap. 4) Calcuation will have to occur upon page load and tab click. */ //If either collapsable or personalizable, add height for that button row. if (bottomButtons) desiredHeight+=18; //If section is available, then show tabs for site and section, and add corresponding height. if (showSection) desiredHeight+=18; var totalCharacters = 0; for (i=0; i 115) { desiredHeight = 59; for (i=0; i 105) else desiredHeight=192; return desiredHeight; } function calcMultiplier(num) { var multiplier=1; var heightFactor=0; multiplier = Math.round ((module[num].content[i].linkText.length)/18); //approximate height of 1 line, within headline heightFactor+=(10*multiplier); //approximate height of break between headlines. heightFactor+=13; return heightFactor; } function calcCorrections(num) { //This function assumes the length of a line in characters and uses some logical padding to handle cases off the mean. The numbers here are developed in the grey area between reason and trial & error. var heightIncrement=0; var numSpaces=0; var textLength =0; textLength= module[num].content[i].linkText.length; /* Here we're dividing the estimated last line into three length possibilities: <=11 , mid length, and >=23. If small, add 4 pixels. If med, do nothing. If large, subtract 4 pixels. This correction handles the coincidental situation where all four headlines are either short or long remainders, which normally would give too little or too much height to the iframe, respectively. */ for (j=0; j< textLength; ++j) { if (module[num].content[i].linkText.charAt(j)==" ") { ++numSpaces; } } if (textLength >=31 && numSpaces <=3) heightIncrement+=14; numSpaces=0; modulus = module[num].content[i].linkText.length%29; if (textLength >30) { if (modulus <=10) { heightIncrement+=5; } if (modulus >=20) { heightIncrement-=7; } } return heightIncrement; } function setVis (visElement, height) { //Hide all of the div tag contents except the one passed in. var theElements = new Array("closedsection", "opensection", "closedsite", "opensite"); var currTop = startHeight; setIframeHeight(height); setTop(visElement,currTop); showIt(visElement); for (i=0; i