﻿
var currentFlyout;
var currentHover;

function showFlyout(elm, flyOutId, topPos, leftPos)
{
    if(currentFlyout){
        hideFlyout();
    }
    if(navigator.appName == "Netscape")
    {
        topPos += 14;
        leftPos -= 250;
    }
    currentFlyout = document.getElementById(flyOutId);
    currentFlyout.style.display = 'block';
    setLyr(elm, topPos, leftPos);
}

function setLyr(obj,topPos, leftPos)
{
    var coors = findPos(obj, topPos, leftPos);
    currentFlyout.style.top = coors[1] + 'px';
    currentFlyout.style.left = coors[0] + 'px';
}

function findPos(obj,topPos,leftPos)
{
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) {
	        curleft += obj.offsetLeft + leftPos;
	       // curleft +=;
	        curtop += obj.offsetTop + topPos;
        }
    }
    return [curleft,curtop];
}

function hideFlyout()
{
    currentFlyout.style.display = 'none';
}

function newEquipmentImageRoll(div, img, iSrc, clsName)
{
    img = document.getElementById(img);
    div = document.getElementById(div);
    img.src = iSrc;
    div.className = clsName;
}

function showTab(div)
{
    document.getElementById('divOverview').className = 'notabdiv';
    if (document.getElementById('divFeatures') != null) document.getElementById('divFeatures').className = 'notabdiv';
    if (document.getElementById('divStandard') != null) document.getElementById('divStandard').className = 'notabdiv';
    if (document.getElementById('divOptional') != null) document.getElementById('divOptional').className = 'notabdiv';
    document.getElementById('divWorkTools').className = 'notabdiv';
    document.getElementById(div).className = 'tabdiv';
}

function tabStyle(li)
{
    var tabNav = document.getElementById('tab').getElementsByTagName('li');
    for(var i=0; i < tabNav.length; i++)
    {
        tabNav[i].className = 'unselected';
    }
    li.className = 'selected';
}

function clearSearchBox(elm)
{
    if(elm.value == "Search Finning Canada")
    {
        elm.value = "";
    }   
}