function MM_jumpMenuGo(objId,targ,restore){ //v9.0
  var selObj = null;  with (document) { 
  if (getElementById) selObj = getElementById(objId);
  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0; }
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function fontSizeUp() {
	// read the cookie (or current setting)
	var cookie = readCookie("is7_fontSize");
	var is7_fontSize = cookie ? cookie : getStyleById('body', 'fontSize'); //var is7_fontSize = getStyleByTag('body', 'fontSize');
	// increase is7_fontSize by +4pts (up to 32pts)
	switch (is7_fontSize) {
    case '12pt' : 
      var is7_fontSize='14pt';
      break;
    case '14pt' : 
      var is7_fontSize='18pt';
      break;
    case '18pt' : 
      var is7_fontSize='22pt';
      break;
	case '22pt' : 
      var is7_fontSize='26pt';
      break;
	case '26pt' : 
      var is7_fontSize='30pt';
      break;
    case '30pt' :
      break;
    default :
      var is7_fontSize='12pt';
      break;
	}
	// save the new value of is7_fontSize in a cookie
	createCookie('is7_fontSize', is7_fontSize , 365)
	// set new fontSize based on new value for is7_fontSize
	setActiveFontSize(is7_fontSize);
}



function fontSizeDown() {
	// read the cookie (or current setting)
	var cookie = readCookie("is7_fontSize");
	var is7_fontSize = cookie ? cookie : getStyleById('body', 'fontSize'); //var is7_fontSize = getStyleById('body', 'fontSize');
	// decrease is7_fontSize by -4pts (down to 12pts)
	switch (is7_fontSize) {
    case '30pt' : 
      var is7_fontSize='26pt';
      break;
    case '26pt' : 
      var is7_fontSize='22pt';
      break;
    case '22pt' : 
      var is7_fontSize='18pt';
      break;
	case '18pt' : 
      var is7_fontSize='14pt';
      break;
	case '14pt' : 
      var is7_fontSize='12pt';
      break;
    case '12pt' :
      break;
    default :
      var is7_fontSize='12pt';
      break;
	}
	// save the new value of is7_fontSize in a cookie
	createCookie('is7_fontSize', is7_fontSize , 365)
	// set new fontSize based on new value for is7_fontSize
	setActiveFontSize(is7_fontSize);
}

function setActiveFontSize(is7_fontSize) {
	setStyleByTag('body', 'fontSize', is7_fontSize, 1);
	adjustLayout();
}



function initializeFontSize() {
	var cookie = readCookie("is7_fontSize");
	var is7_fontSize = cookie ? cookie : getStyleById('body', 'fontSize');
	setActiveFontSize(is7_fontSize);
}



// xGetElementById r2, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xGetElementById(e)
{
  if(typeof(e)=='string') {
    if(document.getElementById) e=document.getElementById(e);
    else if(document.all) e=document.all[e];
    else e=null;
  }
  return e;
}

// xNum r2, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xNum()
{
  for(var i=0; i<arguments.length; ++i){if(isNaN(arguments[i]) || typeof(arguments[i])!='number') return false;}
  return true;
}

// xDef r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xDef()
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}

// xStr r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xStr(s)
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}
  return true;
}

// xGetComputedStyle r7, Copyright 2002-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xGetComputedStyle(e, p, i)
{
  if(!(e=xGetElementById(e))) return null;
  var s, v = 'undefined', dv = document.defaultView;
  if(dv && dv.getComputedStyle){
    s = dv.getComputedStyle(e,'');
    if (s) v = s.getPropertyValue(p);
  }
  else if(e.currentStyle) {
    v = e.currentStyle[xCamelize(p)];
  }
  else return null;
  return i ? (parseInt(v) || 0) : v;
}

// xHeight r6, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xHeight(e,h)
{
  if(!(e=xGetElementById(e))) return 0;
  if (xNum(h)) {
    if (h<0) h = 0;
    else h=Math.round(h);
  }
  else h=-1;
  var css=xDef(e.style);
  if (e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
    h = xClientHeight();
  }
  else if(css && xDef(e.offsetHeight) && xStr(e.style.height)) {
    if(h>=0) {
      var pt=0,pb=0,bt=0,bb=0;
      if (document.compatMode=='CSS1Compat') {
        var gcs = xGetComputedStyle;
        pt=gcs(e,'padding-top',1);
        if (pt !== null) {
          pb=gcs(e,'padding-bottom',1);
          bt=gcs(e,'border-top-width',1);
          bb=gcs(e,'border-bottom-width',1);
        }
        // Should we try this as a last resort?
        // At this point getComputedStyle and currentStyle do not exist.
        else if(xDef(e.offsetHeight,e.style.height)){
          e.style.height=h+'px';
          pt=e.offsetHeight-h;
        }
      }
      h-=(pt+pb+bt+bb);
      if(isNaN(h)||h<0) return;
      else e.style.height=h+'px';
    }
    h=e.offsetHeight;
  }
  else if(css && xDef(e.style.pixelHeight)) {
    if(h>=0) e.style.pixelHeight=h;
    h=e.style.pixelHeight;
  }
  return h;
}


function adjustLayout() {
	// Get Natural Heights of top header areas:
	var leftTabHeight = xHeight("leftTab");
	var rightTabHeight = xHeight("rightTab");
	var maxTopTabHeight = Math.max(leftTabHeight, rightTabHeight);
	var logoHeight = xHeight("logo");
	var giveTabHeight = xHeight("giveTab");
	
	var navMiniTabOrangeHeight = xHeight("navMiniTabOrange");
	var navMiniTabBlueHeight = xHeight("navMiniTabBlue");
	var maxNavMiniTabs = Math.max(navMiniTabOrangeHeight, navMiniTabBlueHeight);
	
	
	// Find the new heights
	var logoPaddingTop = maxTopTabHeight - 43;
	if(logoPaddingTop < 0)
	{
		logoPaddingTop = 0;
	}
	else if(logoPaddingTop == 25)
	{
		logoPaddingTop = 12;
	}
	var navPaddingTop = Math.max((logoHeight + logoPaddingTop - maxTopTabHeight), giveTabHeight);
	
	// Set new top heights via css
	setStyleById("navMiniTabsContainer", "paddingTop", navPaddingTop+"px");
	setStyleById("logo", "marginTop", logoPaddingTop+"px");
	
	
	
	//Get Natural Heights of content areas:
	var bcHeight =  xHeight("breadcrumb") - 21;
	var poHeight =  xHeight("pageOptions") - 21;
	var maxContentLinksHeight = Math.max( bcHeight,poHeight);
	
	var cHeight =  xHeight("center");
	var rHeight =  xHeight("sidebar-right");
	var lHeight =  xHeight("sidebar-left");
	var maxContentHeight = Math.max(cHeight,Math.max( rHeight,lHeight));

	// Set new content heights via css
	setStyleById("contentLinks", "height", maxContentLinksHeight+"px");
	
	setStyleById("sidebar-right", "height", maxContentHeight+"px");
	setStyleById("sidebar-left", "height", maxContentHeight+"px");
	
	
	//show calcs for now
	//document.getElementById('hiddenfooter').innerHTML= "navPaddingTop: " + navPaddingTop + "<BR>maxTopTabHeight: " + maxTopTabHeight + "<BR>giveTabHeight: " + giveTabHeight + "<BR>logoPaddingTop: " + logoPaddingTop +"<BR>maxNavMiniTabs: " + maxNavMiniTabs +"<BR>bcHeight: " + bcHeight +"<BR>poHeight: " + poHeight;
}

