      // Tab menu functions by Jack Letourneau, February 2002
      // http://eigengrau.com/

        //modified code by SmartBrief, Inc. 07/2004
        var set = false;
        function setHeight()
        {
            if(!set)
            {
                //var portalHeight = document.getElementById('table1').rows[0].height;
                var portalHeight = document.getElementById('cell1').offsetHeight;
                if(portalHeight>0)
                {
                    document.getElementById('cell2').height = portalHeight;
                    document.getElementById('cell3').height = portalHeight;
                    set = true;
                }
            }
        }

        function switchOn(tabid, contentsid) {
        setHeight();
        // Pass it a tab ID and a contents ID, single-quoted:
        // switchOn('tab1','contents1')
        // Sets all tabs and contents to inactive state, then
        // activates the tab/contents passed as parameters
        switchAllOff();
        document.getElementById(tabid).className = 'selectedtab';
        document.getElementById(contentsid).className = 'selectedcontents';


      }

      function clearTop() {

        // Sets all tabs to inactive state. Depends on the TR
        // enclosing the tabs having ID 'toprow'

        topRow = document.getElementById('toprow');
        tabArray = topRow.childNodes;
        for (var i=0; i<tabArray.length; i++) {
          if (tabArray[i].className != 'tabspacer') {
            tabArray[i].className = 'tab';
          }
        }
      }

      function clearContents() {

        // Hides all DIVs in TD ID='contentscell'

        contentsCell = document.getElementById('contentscell');
        contentsArray = contentsCell.childNodes;
        for (var j=0; j<contentsArray.length; j++) {
          contentsArray[j].className = 'contents';
        }
      }

      function switchAllOff() {

        // Trivial little wrapper function; sets all tabs and
        // contents to inactive/invisible state

        clearTop();
        clearContents();
      }

     //write the content
document.writeln('     <table id="tabmenu" border="0" cellpadding="0" cellspacing="0" width="138">');

document.writeln('          <tr id="toprow">');
document.writeln('            <td class="tab" id="tab1"><div onclick="switchOn(\'tab1\', \'contents1\');"></div></td>');
document.writeln('          </tr>');
document.writeln('          <tr>');
document.writeln('            <td id="contentscell" colspan="3">');
document.writeln('              <div class="contents" id="contents1">');
document.writeln('                <table id="table1" width="245" border="0" cellpadding="0" cellspacing=>');
document.writeln('                    <tr>');
document.writeln('                        <td valign="top" class="headline" id="cell1">');

document.writeln('                              <script type="text/javascript">');
document.writeln('                              <!--');
document.writeln('                                for( j = 0; j < sections.length; j++ )');
document.writeln('                                {');
document.writeln('                                    var stories = sections[j].stories;');
document.writeln('                                    for( i = 0; i < stories.length; i++ )');
document.writeln('                                    {');
document.writeln('                                        var story_url = SB_LINK+"copyid="+stories[i].copyid+"&briefid="+issue.brief+"&issueid="+issue.id+"&style="+issue.style');
document.writeln('                                        var linkHref = SB_SERVER + "/servlet/rdrc?u="+escape(story_url)+"&i="+issue.id+"&p="+SB_PORTAL_ID;');
document.writeln('                                        document.write(\'<a class="headline" target="smartbrief.com" href="\'+linkHref+\'">\'+stories[i].headline+\'</a\>\');');
	document.writeln('                                        document.write(\'<span class="source">\'+stories[i].link+\'</span>\');');
	document.writeln('                                        document.write(\'<br/><br/>\');');
document.writeln('                                    }');
document.writeln('                                }');
document.writeln('                                -->');
document.writeln('                               </script>');




document.writeln('                            </td>');
document.writeln('                        </tr>');
document.writeln('                    </table>');
document.writeln('              </div>');
document.writeln('            </td>');
document.writeln('          </tr>');

document.writeln('      </table>');
document.writeln('      <script type="text/javascript" language="javascript">switchOn(\'tab1\',\'contents1\');</script>');
