﻿var CURRENT_PATH = null;
var CURRENT_SECTION = null;
var CURRENT_MENU_LINK = null;
var CURRENT_MENU_FLAG = null;

var CURRENT_NAME_PREFIX = "ctl00_ctl00_";

//function Highlight(link,isHighlight,descID,flag)
//{
//    var imgSrcs = null;
//    
//    if(typeof flag != 'undefined' && link != null)
//    {
//        imgSrcs = GenerateNavBgSrc();        
//        bgimage = GetNavImg(imgSrcs,isHighlight,flag);
//        if(bgimage)
//        {
//            bgcolor = "Transparent";
//            bgimage = "url(" + CURRENT_PATH  + bgimage + ")";
//            bgrepeat = "no-repeat";
//        }
//        else
//            bgimage = "";
//    
//        link.style.background = bgcolor + " " + bgimage + " " + bgrepeat;    
//    }     
//    
//    ProcessNavDescription(isHighlight,descID);
//}

function Highlight(link,isHighlight,descID,flag)
{
    var imgSrcs = null;
    
    var bgcolor = "#660000";
    var bgimage = "";
    var bgrepeat = "";
    var bgpos = "";

    if (typeof flag != 'undefined' && flag != null) {
        imgSrcs = GenerateNavBgSrc();
        bgpos = imgSrcs["position_" + flag];

        bgimage = GetNavImg(imgSrcs, isHighlight, flag);
        if (bgimage) {
            bgimage = "url(" + CURRENT_PATH + bgimage + ")";
            bgrepeat = "no-repeat";
        }
        else {
            bgimage = "";
            bgpos = "";
        }
    }    
    
    if(isHighlight)
        bgcolor = "#000033";    
    
    if(descID == CURRENT_SECTION)
    {
        bgcolor = "#000033";
            
        if(imgSrcs != null)
        {
            bgimage = GetNavImg(imgSrcs,true,flag);
            if(bgimage)
            {
                bgimage = "url(" + CURRENT_PATH  + bgimage + ")";
                bgrepeat = "no-repeat";
            }
            else
                bgimage = "";
        }
    }
    
    link.style.background = bgcolor + " " + bgimage + " " + bgrepeat + " " + bgpos;
    
    ProcessNavDescription(isHighlight,descID);
}

function GetNavImg(srcs,isHighlight,type)
{
    var suffix = "_up";
    if(isHighlight)
        suffix =  "_over";
    
    return srcs[type + suffix];
}

function GenerateNavBgSrc()
{
    return {
        left_up : 'components/img/menu_corner_left_up.jpg',
        left_over: 'components/img/menu_corner_left_over.jpg',
        right_up: 'components/img/menu_corner_right_up.jpg',
        right_over: 'components/img/menu_corner_right_over.jpg',
        position_left: '0px 0px',
        position_right: '162px 0px'
    }
}

function ProcessNavDescription(doShow, descID)
{
    var text = new String();
    var vis = "hidden";
    
    if(doShow)
    {
        vis = "visible";
        text = GetBubbleText(descID);        
        if(!text)
            text = new String();
    }
    
    var bubble = document.getElementById("navbubble");
    var bubbletext = document.getElementById("navbubbletext");
    if(bubble && bubbletext)
    {
        bubble.style.visibility = vis;
        bubbletext.innerHTML = text;
    }
}

function GetBubbleText(descID)
{
    var txts = GenerateBubbleText();
    
    return txts[descID];
}

function GenerateBubbleText()
{
    return{
        who_we_are : 'We are a Colorado-based, software consulting company offering custom Web and application development, implementation support, data services, and Web strategy and project management.',
        services : 'We offer a wide variety of services all focusing on our core principle of delivering viable technology solutions to make your business thrive.',
        clients : 'We have a long-standing reputation for delivering optimal business solutions and providing excellent customer service.',
        contact_us : "We'd love to hear from you.  Send us an e-mail or call us 720.945.7420.",
        careers : 'We seek individuals who share our passion for viable technology solutions.'}
}

function SetPageMenuHighlight()
{
    if(CURRENT_MENU_LINK && CURRENT_SECTION && CURRENT_NAME_PREFIX)
    {
        var link = document.getElementById(CURRENT_NAME_PREFIX + CURRENT_MENU_LINK);
        
        if(link)
        {
            Highlight(link,true,CURRENT_SECTION,CURRENT_MENU_FLAG);
        }
    }
}