
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-2830198-2");
pageTracker._trackPageview();
} catch(err) {}


hasDOM = (document.getElementById) ? true : false;
IE = (document.all) ? true : false;
V = "visible";
H = "hidden";

if (hasDOM) {
  layerDom = "document.getElementById('";
  elemEnd = "')";
  idsDom = "document.getElementById('";
  pLeft = "').style.left";
  pTop = "').style.top";
  pHeightS = "').style.height";
  pWidth = "').style.width";
  pWidth2 = "').style.width";
  pWidth3 = "').offsetWidth";
  pHeight = "').offsetHeight";
  pVis = "').style.visibility";
  pBgColor = "').style.backgroundColor";
}

if (IE) {
  layerDom = "document.all['";
  elemEnd = "']";
  idsDom = "document.all['";
  pLeft = "'].style.pixelLeft";
  pTop = "'].style.pixelTop";
  pHeightS = "'].style.pixelHeight";
  pWidth = "'].style.pixelWidth";
  pWidth2 = "'].style.pixelWidth";
  pWidth3 = (navigator.appVersion.indexOf("MSIE 4") != -1) ? "'].scrollWidth" : "'].offsetWidth";
  pHeight = (navigator.appVersion.indexOf("MSIE 4") != -1) ? "'].scrollHeight" : "'].offsetHeight";
  pVis = "'].style.visibility";
  pBgColor = "'].style.backgroundColor";
}

JSok = (IE || hasDOM) ? true : false;

function getLeft(what) {
  eElement = eval(layerDom+what+elemEnd);
  nLeftPos = eElement.offsetLeft;
  eParElement = eElement.offsetParent;
  while (eParElement != null) {
    nLeftPos += eParElement.offsetLeft;
    eParElement = eParElement.offsetParent;
  }
  return nLeftPos;
}

////

mY = null;
mX = null;
subEvent = null;
eId = 0;
nowShowing = new Array();
lastMain = null;
lastOver = null;

function trackMouse(e) {
  mY = (!IE) ? e.pageY : event.clientY + document.body.scrollTop;
  mX = (!IE) ? e.pageX : event.clientX + document.body.scrollLeft;
}

function isOver() {
  hide=null;
  if (mY && mX && cOA.length > 1) {
    if (!((mX > cOA[0] && mY > cOA[1] && mX < cOA[2] && mY < cOA[3]) || (mX > cOA[4] && mY > cOA[5] && mX < cOA[6] && mY < cOA[7]))) {
      hideLayer(cOA[9]);
      hide=1;
      if (cOA.length>11) {
        cOA = cOA.slice(10,cOA.length);
      } else {
        cOA = new Array();
      }
    }
  }
}

function showSubs() {
  subLevel = arguments[1];

  subEvent = 1;
  eId++;
  myeId = eId;
  checkOpen(subLevel,myeId);
  if (subLevel == 0) {
    lastMain = arguments[0].id;
  }
  for (i=2;i<arguments.length;i++) {
    showLayer(arguments[i]);
    nowShowing[nowShowing.length] = arguments[i];
    nowShowing[nowShowing.length] = subLevel;
    nowShowing[nowShowing.length] = myeId;
  }
}

function checkOpen(subLevel,myeId) {
  remove = new Array();
  newNS = new Array();
  for (j=0;j<nowShowing.length;j+=3) {
    if (nowShowing[j+1] >= subLevel && nowShowing[j+2] != myeId) {
      hideLayer(nowShowing[j]);
      remove[remove.length] = j;
      remove[remove.length] = j+1;
      remove[remove.length] = j+2;
    }
  }
  rIndx = 0;
  if (remove.length > 1) {
    for (j=0;j<nowShowing.length;j++) {
      if (!remove.length > rIndx) {
        newNS[newNS.length] = nowShowing[j];
      } else {
        if (remove[rIndx] != j) {
          newNS[newNS.length] = nowShowing[j];
        } else {
          rIndx++;
        }
      }
    }
    nowShowing = new Array();
    nowShowing = newNS;
    if (nowShowing.length < 1) {
      lastMain = null;
    }
  }
}

function clickClose() {
  dv = null;
  if (lastOver) {
    for (k=0;k<nowShowing.length;k+=3) {
      if (nowShowing[k] == lastOver) {
        dv = 1;
      }
    }
    if (lastOver == lastMain) {
      dv = 1;
    }
  }
  if (!dv) {
    for (c=0;c<nowShowing.length;c+=3) {
      hideLayer(nowShowing[c]);
    }
    nowShowing = new Array();
  }
}

function showLayer(what) {
  l = getLeft(lastMain);
  if (IE) {
    eval(layerDom+what+pLeft+" = "+l);
  } else {
    eval(layerDom+what+pLeft+" = '"+l+"px'");
  }
  eval(layerDom+what+pVis+" = '"+V+"'");
}

function hideLayer(what) {
  eval(layerDom+what+pVis+" = '"+H+"'");
}

function init() {
  setVars();
  if (IE) {
    document.onmousemove = trackMouse;
    document.onmouseup = checkBTNClick;
    scrolling = window.setInterval("scrollNav()",1);
    lnavHeight = parseInt(eval(layerDom+"content-left-col"+pHeight));
    rnavHeight = parseInt(eval(layerDom+"content-right-col"+pHeight));
    if (lnavHeight < rnavHeight) {
      tOff = eval(layerDom+"content-right-col"+pHeight);
      eval(layerDom+"content-left-col"+pHeightS+" = "+tOff);
    }
  } else if (hasDOM) {
    document.addEventListener('mousemove', trackMouse, true);
    document.addEventListener('mouseup', checkBTNClick, true);
    scrolling = setInterval("scrollNav()",1);
  }
}

function checkBTNClick(e) {
  clickClose();
  //if (lastOver) {
  //  goLink(lastOver);
  //}
}

function getWindowHeight() {
  gWH = (IE && !hasDOM) ? document.body.clientHeight : parseInt(window.innerHeight);
   if (IE) {
    if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
      gWH = document.documentElement.clientHeight;
    } else {
      gWH = document.body.clientHeight;
    }
  }
  if (hasDOM && !IE) {
    gWH = parseInt(window.innerHeight);
  }
  return gWH;
}

function setVars() {
  windowHeight = getWindowHeight();
  navHeight = parseInt(eval(layerDom+"content-left-col"+pHeight));
  navObj = eval(layerDom+"content-left-col"+elemEnd);
  allowScroll = (windowHeight < navHeight || allowScroll == 0) ? 0 : 1;
}

lastScrollTop = null;
windowHeight = null;
navHeight = null;
topOff = 188;
navObj = null;
// allow other javascript to override default on state
allowScroll = (typeof(allowScroll) != 'undefined') ? allowScroll : 1;

function scrollNav() {
  if (allowScroll == 1) {
    if (IE) {
      if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
        scrollTop = document.documentElement.scrollTop;
      } else {
        scrollTop = document.body.scrollTop;
      }
    }
    if (hasDOM && !IE) {
      scrollTop = window.pageYOffset;
    }
    
    lnavHeight = parseInt(eval(layerDom+"content-left-col"+pHeight));
    rnavHeight = parseInt(eval(layerDom+"content-right-col"+pHeight));
    
    //window.status = navHeight+" "+windowHeight+" "+topOff+" "+scrollTop;
    if (scrollTop != lastScrollTop && scrollTop > topOff) {
      padTop = (scrollTop-topOff+25 > rnavHeight-navHeight) ? rnavHeight-navHeight : scrollTop-topOff+25;
      navObj.style.paddingTop = padTop+"px";
      lastScrollTop = scrollTop;
    }
    if (scrollTop < topOff) {
      navObj.style.paddingTop = "0px";	
    }
  }
}

onload=init;

