﻿
window.onload = function()
{
    PreloadImages();
}

function PreloadImages()
{
    var urls = [
        "img/callout_lab_expectations_hover.jpg", 
        "img/callout_pdei_process_hover.jpg",
        "img/callout_signup_hover.jpg",
        "img/left_nav_bottom_hover.jpg" ]
        
    for (var i = 0; i <= urls.length; i++) 
    {
        var img = new Image();
        img.src = urls[i];
    }
}

function ToggleImg(img)
{
    var index = img.src.lastIndexOf(".");
    var root = img.src.substr(0, index);
    var ext = img.src.substr(index + 1); 

    index = root.indexOf("_hover");
    if (index == -1)
        img.src = root + "_hover." + ext;
    else
        img.src = root.substr(0, index) + "." + ext;
}

function ClearSearchBox(searchBox)
{
    if (searchBox.value == "SEARCH")
        searchBox.value = "";
}

function SwapLeftNavBottom(td)
{ 
    if (td.className.indexOf("sel") != -1)
        return;
        
    var index = td.style.backgroundImage.lastIndexOf(".");
    var root = td.style.backgroundImage.substr(0, index);
    var ext = td.style.backgroundImage.substr(index + 1); 
    
    index = root.indexOf("_hover");
    if (index == -1)
        td.style.backgroundImage = root + "_hover." + ext;
    else
        td.style.backgroundImage = root.substr(0, index) + "." + ext;       
}

function ToggleSubNavMenu(id)
{
    var content1 = document.getElementById("content1");
    var content2 = document.getElementById("content2");
    var content3 = document.getElementById("content3");
    var content4 = document.getElementById("content4");

    scroll(0,0);

    if (id == 1)
    {   
        if (content1.style.display == "")
            content1.style.display = "none";
        else
        {
            content1.style.display = "";
            content2.style.display = "none";
            content3.style.display = "none";
            content4.style.display = "none";
        }
        return;
    }
    
    if (id == 2)
    {   
        if (content2.style.display == "")
            content2.style.display = "none";
        else
        {
            content1.style.display = "none";
            content2.style.display = "";
            content3.style.display = "none";
            content4.style.display = "none";
        }
        return;
    }
    
    if (id == 3)
    {   
        if (content3.style.display == "")
            content3.style.display = "none";
        else
        {
            content1.style.display = "none";
            content2.style.display = "none";
            content3.style.display = "";
            content4.style.display = "none";
        }
        return;
    }
    
    if (id == 4)
    {   
        if (content4.style.display == "")
            content4.style.display = "none";
        else
        {
            content1.style.display = "none";
            content2.style.display = "none";
            content3.style.display = "none";
            content4.style.display = "";
        }
        return;
    }
}