// JavaScript Document
<!--
// Declare variables
var D   = document;
var DOM = D.getElementById;
var IE  = D.all;
var bShowTip = 0;
var nXOffset = IE ? 1 : 0;   // X offset from cursor
var nYOffset = IE ? -1 : 0;  // Y offset from cursor
var nSpacing = IE ? 0 : 0;    // Reconcile spacing for consistent edge detection
var x=0, y =0, W = 0, H = 0,SW = 0,SH = 0,nMove = 0;

function showTip(tip,header){  
  var oBubble = D.getElementById('bubble');
  if (!DOM || typeof oBubble=='undefined') return;
  if (tip) {
    // Render tooltip; get its true size
    if (oBubble.style.display == 'none')
    {
      var tempText = "";
      tempText = "<p style='font-size:16px; color:#008BCE; font-family:Arial, Helvetica, sans-serif'><b>" + header + "</b></p>";
      tempText += eval(tip);
      oBubble.innerHTML = tempText; //eval(sTerm + '.definition'); 
      oBubble.style.visibility = 'hidden';
      oBubble.style.display = 'block';
      nTipWidth = oBubble.offsetWidth;
      nTipHeight = oBubble.offsetHeight;
      oBubble.style.display = 'none';
      oBubble.style.visibility = 'visible';
      bShowTip = 1;
      moveTip();
    }
  } else {
    // Hide tooltip if no argument passed
    oBubble.style.display= 'none';
    bShowTip = 0;
  }
}

function showPopup(show) {
  //alert(show);
  var oBubble = D.getElementById('bubble');
  oBubble.style.visibility = (show) ? "visible" : "hidden";
  oBubble.style.display = (show) ? '' : "none";
}

function moveTip() {
  // Position tooltip; ensure it doesn't bleed
  var oBubble = D.getElementById('bubble');
  oBubble.style.left = (((_tW=x+nTipWidth)<=W) ? x : x-(_tW-W)) + 'px';
  oBubble.style.top = ((nTipHeight+nYOffset+nSpacing>=y-SH || y+nTipHeight<=H+SH) ? y : y-nTipHeight-nYOffset-nSpacing-1) + 'px';
  oBubble.style.display = 'block';
}

function setDocSize() {
  // -16 to account for scrollbar in Gecko browsers
  W = window.innerWidth-16 ||
      D.documentElement.clientWidth ||
      D.body.clientWidth;
  H = window.innerHeight ||
      D.documentElement.clientHeight ||
      D.body.clientHeight;
}

function setScrollSizeMain() {
  SW = window.pageXOffset ||
       D.body.scrollLeft ||
       D.documentElement.scrollLeft;
  SH = window.pageYOffset ||
       D.body.scrollTop ||
       D.documentElement.scrollTop;
}

function trackPosMain() {
  D.onmousemove = function(e) {
  setDocSize();
  setScrollSizeMain();
    if (e) {
      x = e.pageX;
      y = e.pageY;
    } else {
      x = event.clientX + SW;
      y = event.clientY + SH;
    }
    x += nXOffset;
    y += nYOffset;
    //if (bShowTip) moveTip();
  }
  setTimeout("trackPosMain()", 200);
}

function setScrollSizeTOMI() { // this method is differnent for main-site
  SW = window.pageXOffset ||
       D.body.scrollLeft ||
       D.documentElement.scrollLeft;
  SH = document.getElementById('right').scrollTop;
       //D.body.scrollTop ||
       //D.documentElement.scrollTop;
}

function trackPosTOMI() { // this method is differnent for main-site
    trackTomiDoc();
    D.onmousemove = function(e) { 
    if (e) {
      x = e.pageX + SW - 200;
      y = e.pageY + SH - 110;
    } else {
      x = event.clientX + SW - 200;
      y = event.clientY + SH - 110;
    }
    x += nXOffset;
    y += nYOffset;
    //if (bShowTip) moveTip();
  }
  setTimeout("trackPosTOMI()", 200);
}

function trackTomiDoc()
{
   setDocSize();
   setScrollSizeTOMI();
}

function  writeBubble() {
  D.write('<div id="bubble" onmouseover="showPopup(true)" onmouseout="showPopup(false)" style="position:absolute;width:250px;hight:400px;background:#ffffff;border:1px solid #56D34D;display:none;padding:.5em;z-index:100"></div>');
}

 var theobj;
  var thetext;
  var winWidth;
  var timerID;
  var header = "";
  
  function buildText(value) {
 
  text="<div class='alert mb0 ml10 p0505' "
  text+="style='width:"+(winWidth)+"px;'>"
  if ( header != "" )
  {
      text+="<p style='font-size:14px;'><b>" + header + "</b></p>"
  }
  text += "<p>" + value + "</p>"
  text+="</div>"
  return text
  }
  
  function viewPopup(textId,inwidth,textValue,textHeader) {
    winWidth=inwidth;
    if ( textId.indexOf(textValue) == 0 )
    {
      textValue = eval( textValue );
    }
    if ( textHeader != null )
    {
       header = textHeader;
    }
    else
    {
      header = "";
    }
    thetext=buildText(textValue);
          if(theobj != null){
            theobj.innerHTML = "";
            theobj.style.visibility="hidden";
          }
    theobj=document.getElementById(textId);
    theobj.style.width=winWidth;
    theobj.innerHTML = "";
    theobj.innerHTML=thetext;
    theobj.style.visibility="visible";
  }
  function hidePopup() {
    if(theobj != null){
      theobj.innerHTML = "";
      theobj.style.visibility="hidden";
    }
  }

function highlighttable(arrayOfIDsShow)
{
  if ( typeof( arrayOfIDsShow.length) == 'undefined')
    return false;

  for ( var i = 0; i< arrayOfIDsShow.length; i++ )
  {
    var moreItems = arrayOfIDsShow[ i ];
    var moreStuff = document.getElementById(moreItems);
    moreStuff.style.display = '';
  }
  return true;
}

function diminishtable(arrayOfHides)
{
  if ( typeof( arrayOfHides.length) == 'undefined')
    return false;

  for ( var i = 0; i< arrayOfHides.length; i++ )
  {
    var moreSKU = arrayOfHides[ i ];
    var moreID = document.getElementById(moreSKU);
    moreID.style.display = 'none';
  }
  return true;
}
//-->