// by Pau@YellowPencil.com and Scot@YellowPencil.com
// feel free to delete all comments except for the above credit

function setTall() {
    if (document.getElementById) {

        // the divs array contains references to each column's div element.  
        // Replace 'left' 'center' with your own.  
        // Or remove the last one entirely if you've got 2 columns.  Or add another if you've got 4!
        var divs = new Array(document.getElementById('leftnav'), document.getElementById('content'));

        // Let's determine the maximum height out of all columns specified
        var maxHeight = 0;
        for (var i = 0; i < divs.length; i++) {
      if (divs[i]) {
              if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
      }
        }

        // Let's set all columns to that maximum height
        for (var i = 0; i < divs.length; i++) {
      if (divs[i]) {
            divs[i].style.height = maxHeight + 'px';

            // Now, if the browser's in standards-compliant mode, the height property
            // sets the height excluding padding, so we figure the padding out by subtracting the
            // old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
            if (divs[i].offsetHeight > maxHeight) {
                divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
            }
      }
        }

    }
}


window.onload = function() {

    setTall();
    /* Replace startList below if loadHover is used
    if(typeof(loadHover)=="function") {
        loadHover();
    }
    */

    if(typeof(window.startList)=="function") {
        startList();
    }
}

window.onresize = function() {
    setTall();
}

var menuHover = true;

var infowin = null;

function newPopWin(url,w,h)
{
  infowin = window.open("","","toolbar=yes,location=yes,scrollbars=yes,resizable=yes,top=20,left=20,width=" + w + ",height=" + h);
  if (infowin != null)
  {
    infowin.location.href = url;
// is the window.focus method supported by this verison of javascript
// if so, then do it.
    if (window.focus)
    {
       infowin.focus();
    }
  }
// return true;
}

function closePopWin()
{
  if (infowin != null && infowin.open) infowin.close();
// return true;
}                                           



/* NH: Temporary solution until sfir.js errors resolved */
function no_error()
{ return true; }
//window.onerror=no_error;

/* SS: Support functions for hybrid left nav */

function get_absolute_link(relative_link)
{
    var new_link = left_nav_url + relative_link;
    
    var link_elements = relative_link.split("/");
    var up_count = 0;
    
    for (var i = 0; i < link_elements.length; i++)
    {
        if (link_elements[i] == "..")
        {
            up_count++;
        }
    }
    
    if (up_count > 0)
    {
        full_link_elements = left_nav_url.split("/");
        
        for (var i = 0; i <= up_count; i++)
        {
            full_link_elements.pop();
        }
        
        new_link = full_link_elements.join("/") + "/" + link_elements[link_elements.length - 1];
    }

    return new_link;
}

function write_absolute_anchor(relative_link, label)
{
    var new_link = get_absolute_link(relative_link);
    document.writeln("<a href='" + new_link + "'>" + label + "</a>");           
}

/* NH, Browser Fix Stylesheets */
document.write("<!--[if gte IE 6]><link href='http://www.drgarybrown.com/shared/global/css/browserfix_IE6.css' rel='stylesheet' type='text/css'><![endif]-->");
