﻿function cellMouseOver(id)
{
    document.getElementById(id).style.backgroundColor = "#ADCEDC";
}

function cellMouseOut(id)
{
    document.getElementById(id).style.backgroundColor = "#87B7CB";
}

function cellClick(id)
{
    window.location = id;
}

function tabMouseOver(id)
{
}

function tabMouseOut(id)
{
}

function tabClick(id)
{
}

function handleInteract(count)
{
    // no-op...
}

function handleInteract2(count)
{
    // -1 means the count is off...
    if(count < 1)
        return;
        
    // now what?
    if(count >= 3 && count < 9)
    {
        var b = document.getElementById("interactBox");
        b.style.display = "inline";

        // move...
        window.setTimeout("nudgeScroll();", 100);
    }
}

function getClientWidth()
{
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  
  // return...
  return myWidth;
}

function nudgeScroll()
{
    var b = document.getElementById("interactBox");
    
    // top...
    var top = b.getAttribute("interactTop");
    if(top == null)
        top = -300;
    else
        top = parseInt(top, 10);

    // add...
    top += 30;
    b.setAttribute("interactTop", top);
    
    var topS = top + "px";
    b.style.top = top;
    b.style.left = getClientWidth() - 500;
    if(top > 250)
        return;
        
    // set...
    window.setTimeout("nudgeScroll();", 50);
}

function positionLandingNav()
{
    // move...
    var b = document.getElementById("landingNav");
    b.style.left = (getClientWidth() / 2) + 260;
    b.style.visbility = "visible";
    
    // configure...
    moveLandingNav();
}

function configureLandingNavTimer()
{    
    window.setTimeout("moveLandingNav()", 250);
}

function moveLandingNav()
{
    // move...  
    var b = document.getElementById("landingNav");
    b.style.top = document.body.scrollTop + 160;

    // configure...
    configureLandingNavTimer();
}

function positionRegularNav()
{
    configureRegularNavTimer();
}

function configureRegularNavTimer()
{
    window.setTimeout("moveRegularNav()", 250);
}

function moveRegularNav()
{
    // move...  
    var b = document.getElementById("sideNav");
    
    // top...
    var top = document.body.scrollTop;
    var headerHeight = 175;
    if(top < headerHeight)
        top = headerHeight;
    b.style.top = top - headerHeight;

    // configure...
    configureRegularNavTimer();
}
