﻿// Main Navigation Start
var activeID = 0;
var subActiveID = 0;
var activeProductGroup = 0

function fnMainMnuActivate(ID) {
    var menuitem = document.getElementById('mnu' + ID);
    menuitem.style.backgroundImage = "url('/Layout/Images/Menu/MainMenu/On/MenuItem_" + ID + ".png')";
    menuitem.style.backgroundRepeat = "no-repeat";
    menuitem.style.height = "39px";
}

function fnMainMnuDeactivate(ID) {
    if (ID != activeID) {
        var menuitem = document.getElementById('mnu' + ID);
        menuitem.style.backgroundImage = "url('/Layout/Images/Menu/MainMenu/Off/MenuItem_" + ID + ".png')";
        menuitem.style.backgroundRepeat = "no-repeat";
        menuitem.style.height = "39px";
    }
}

function fnSetMainMnuActive(ID) {
    try {
        var menuitem = document.getElementById('mnu' + ID);
        menuitem.style.backgroundImage = "url('/Layout/Images/Menu/MainMenu/On/MenuItem_" + ID + ".png')";
        menuitem.style.backgroundRepeat = "no-repeat";
        menuitem.style.height = "39px";
        activeID = ID;
    }
    catch (ex) { }
}

function fnSubMnuActivate(ID) {
    document.getElementById('subMnu' + ID).className = "menuItemOn";
}

function fnSubMnuDeactivate(ID) {
    if (ID != subActiveID) {
        document.getElementById('subMnu' + ID).className = "menuItemOff";
    }
}

function fnSetSubMnuActive(ID) {
    try {
        document.getElementById('subMnu' + ID).className = "menuItemOn";
        subActiveID = ID;
    }
    catch (ex) { }
}

function fnProductGroupMnuActivate(ID) {
    document.getElementById('pgrpMnu' + ID).className = "productGroupItemOn";
}

function fnProductGroupMnuDeactivate(ID) {
    //alert("pg:" + activeProductGroup + " id:" + ID);
    if (ID != activeProductGroup) {
        document.getElementById('pgrpMnu' + ID).className = "productGroupItemOff";
    }
}

function fnSetProductGroupMnuActive(ID) {
    try {
        document.getElementById('pgrpMnu' + ID).className = "productGroupItemOn";
        activeProductGroup = ID;
    }
    catch (ex) { }
}

//function OpenInWindow(url) {
//    initLightbox();
//    var newa = document.createElement('a');
//    newa.setAttribute('href', url);
//    newa.setAttribute('rel', 'lightbox');
//    myLightbox.start(newa);
//}

function menuNavigate(url)
{
    window.location.href = url;
}

function fnChangeColor(obj)
{
    obj.style.backgroundColor = "#e7e4d7";
}
function fnChangeBackColor(obj)
{
    obj.style.backgroundColor = "#FFFFFF";
}

function fnChangeHoverColor(obj, color) 
{
    obj.style.color = color;
}

function fnChangePointerImage(obj, type, isOn ) {

    if ( isOn ) {

        if (type == 'right') {
            obj.style.backgroundImage = "url('/Layout/Images/Global/RedArrow_usd.png')";
        }
        else {
            obj.style.backgroundImage = "url('/Layout/Images/Global/RedArrowLeft_usd.png')";
        }
    }
    else
    {
        if (type == 'right') {
            obj.style.backgroundImage = "url('/Layout/Images/Global/RedArrow.png')";
        }
        else {
            obj.style.backgroundImage = "url('/Layout/Images/Global/RedArrowLeft.png')";
        }
    }
    
}


