﻿
var oProductsMenuTimerId = 0;
var oServicesMenuTimerId = 0;
var oTipsAndSpecsMenuTimerId = 0;
var oMenuTimeOut = 50;


function insertFlashObject(ctlId, src, width, height, wmode)
{
    if (ctlId == "")
    {
        document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" align=\"middle\">");
    }
    else
    {
        document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + ctlId + "\" align=\"middle\">");
    }
    document.write("	<param name=\"allowScriptAccess\" value=\"always\" />");
    document.write("	<param name=\"movie\" value=\"" + src + "\" />");
    document.write("	<param name=\"quality\" value=\"high\" />");
    document.write("	<param name=\"bgcolor\" value=\"#FFFFFF\" />");
    document.write("	<param name=\"wmode\" value=\"" + wmode + "\" />");
    if (ctlId == "")
    {
        document.write("	<embed src=\"" + src + "\" width=\"" + width + "\" height=\"" + height + "\" align=\"middle\" quality=\"high\" bgcolor=\"#ff0000\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"" + wmode + "\" />");
    }
    else
    {
        document.write("	<embed src=\"" + src + "\" id=\"" + ctlId + "Embed\" width=\"" + width + "\" height=\"" + height + "\" align=\"middle\" quality=\"high\" bgcolor=\"#ff0000\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" name=\"" + ctlId + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"" + wmode + "\" />");
    }
    document.write("</object>");
}


function get$(id)
{
    return document.getElementById(id);
}

function nullVoid()
{
}

//based on http://www.quirksmode.org/js/findpos.html 
function contextMenuFindPos(obj) {

    var curleft = 0; 
    var curtop = 0;

    if (obj.offsetParent) {

        do {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        }
        while (obj = obj.offsetParent);
    }

    return [curleft, curtop];
}


function showProductsMenu(menuButtonCtl)
{

    var menuCtl;
    var pos;
    var newX;
    var newY;
        
    pos = contextMenuFindPos(menuButtonCtl);
    newX = pos[0];
    newY = pos[1] + 16;
        
    menuCtl = document.getElementById("ProductsMenuDiv");
    menuCtl.style.left = newX + "px";
    menuCtl.style.top = newY + "px";
    menuCtl.style.position = "absolute";
    menuCtl.style.display = "block";
    
    menuButtonCtl.style.color = "#EC8000";

}

function hideProductsMenu()
{
    resetHideProductsMenu();
    
    oProductsMenuTimerId = window.setTimeout("hideProductsMenuElapsed();", oMenuTimeOut);  
}

function resetHideProductsMenu()
{
    if (oProductsMenuTimerId != 0)
    {
        window.clearTimeout(oProductsMenuTimerId);
        oProductsMenuTimerId = 0;
    }
}

function hideProductsMenuElapsed()
{
    var menuCtl;
            
    if (oProductsMenuTimerId != 0)
    {        
        oProductsMenuTimerId = 0;
        
        menuCtl = document.getElementById("ProductsMenuDiv");
        menuCtl.style.display = "none";
        
        document.getElementById("ProductsMenuButton").style.color = "";
    }
    
}

function showServicesMenu(menuButtonCtl)
{

    var menuCtl;
    var pos;
    var newX;
    var newY;
        
    pos = contextMenuFindPos(menuButtonCtl);
    newX = pos[0];
    newY = pos[1] + 16;
        
    menuCtl = document.getElementById("ServicesMenuDiv");
    menuCtl.style.left = newX + "px";
    menuCtl.style.top = newY + "px";
    menuCtl.style.position = "absolute";
    menuCtl.style.display = "block";
    
    menuButtonCtl.style.color = "#EC8000";

}

function hideServicesMenu()
{
    resetHideServicesMenu();
    
    oServicesMenuTimerId = window.setTimeout("hideServicesMenuElapsed();", oMenuTimeOut);  
}

function resetHideServicesMenu()
{
    if (oServicesMenuTimerId != 0)
    {
        window.clearTimeout(oServicesMenuTimerId);
        oServicesMenuTimerId = 0;
    }
}

function hideServicesMenuElapsed()
{
    var menuCtl;
            
    if (oServicesMenuTimerId != 0)
    {        
        oServicesMenuTimerId = 0;
        
        menuCtl = document.getElementById("ServicesMenuDiv");
        menuCtl.style.display = "none";
        
        document.getElementById("ServicesMenuButton").style.color = "";
    }
    
}



function showTipsAndSpecsMenu(menuButtonCtl)
{

    var menuCtl;
    var pos;
    var newX;
    var newY;
        
    pos = contextMenuFindPos(menuButtonCtl);
    newX = pos[0];
    newY = pos[1] + 16;
        
    menuCtl = document.getElementById("TipsAndSpecsMenuDiv");
    menuCtl.style.left = newX + "px";
    menuCtl.style.top = newY + "px";
    menuCtl.style.position = "absolute";
    menuCtl.style.display = "block";
    
    menuButtonCtl.style.color = "#EC8000";

}

function hideTipsAndSpecsMenu()
{
    resetHideTipsAndSpecsMenu();
    
    oTipsAndSpecsMenuTimerId = window.setTimeout("hideTipsAndSpecsMenuElapsed();", oMenuTimeOut);  
}

function resetHideTipsAndSpecsMenu()
{
    if (oTipsAndSpecsMenuTimerId != 0)
    {
        window.clearTimeout(oTipsAndSpecsMenuTimerId);
        oTipsAndSpecsMenuTimerId = 0;
    }
}

function hideTipsAndSpecsMenuElapsed()
{
    var menuCtl;
            
    if (oTipsAndSpecsMenuTimerId != 0)
    {        
        oTipsAndSpecsMenuTimerId = 0;
        
        menuCtl = document.getElementById("TipsAndSpecsMenuDiv");
        menuCtl.style.display = "none";
        
        document.getElementById("TipsAndSpecsMenuButton").style.color = "";
    }
    
}
