﻿var inApplicationsHdr, inApplicationsMenu, inPartnersHdr, inPartnersMenu, inServicesHdr, inServicesMenu, inCompanyHdr, inCompanyMenu, inContactHdr, inContactMenu;

function displayMenu(name) {
    document.getElementById('td' + name).style.backgroundColor = '#dfdfdf';
    document.getElementById('td' + name).style.color = '#3985d4';
    document.getElementById('menu' + name).style.left = (findPosX(document.getElementById('img' + name)) - parseInt(document.getElementById('menu' + name).style.width) - 14) + 'px';
    document.getElementById('menu' + name).style.visibility = 'visible';
}

function displayMenuShadow(name) {
    document.getElementById('menu' + name + 'Shadow').style.left = (findPosX(document.getElementById('img' + name)) - parseInt(document.getElementById('menu' + name).style.width) - 18) + 'px';
    document.getElementById('menu' + name + 'ShadowBottom').style.left = (findPosX(document.getElementById('img' + name)) - parseInt(document.getElementById('menu' + name).style.width) - 9) + 'px';
    document.getElementById('menu' + name + 'ShadowBottomLeft').style.left = (findPosX(document.getElementById('img' + name)) - parseInt(document.getElementById('menu' + name).style.width) - 18) + 'px';
    document.getElementById('menu' + name + 'ShadowRight').style.left = (findPosX(document.getElementById('img' + name))) + 'px';
    document.getElementById('menu' + name + 'ShadowBottomRight').style.left = (findPosX(document.getElementById('img' + name)) + 1) + 'px';
    document.getElementById('menu' + name + 'Shadow').style.visibility = 'visible';
    document.getElementById('menu' + name + 'ShadowBottom').style.visibility = 'visible';
    document.getElementById('menu' + name + 'ShadowBottomLeft').style.visibility = 'visible';
    document.getElementById('menu' + name + 'ShadowRight').style.visibility = 'visible';
    document.getElementById('menu' + name + 'ShadowBottomRight').style.visibility = 'visible';
}

function displayMenus() {

    hideMenus();

    if (inApplicationsHdr || inApplicationsMenu) {
        displayMenu('Applications');
    }

    if (inPartnersHdr || inPartnersMenu) {
        displayMenu('Partners');
    }

    if (inServicesHdr || inServicesMenu) {
        displayMenu('Services');
    }

    if (inCompanyHdr || inCompanyMenu) {
        displayMenu('Company');
    }

    if (inContactHdr || inContactMenu) {
        displayMenu('Contact');
    }
}

function displayMenuShadows() {

    hideMenus();

    if (inApplicationsHdr || inApplicationsMenu) {
        displayMenuShadow('Applications');
    }

    if (inPartnersHdr || inPartnersMenu) {
        displayMenuShadow('Partners');
    }

    if (inServicesHdr || inServicesMenu) {
        displayMenuShadow('Services');
    }

    if (inCompanyHdr || inCompanyMenu) {
        displayMenuShadow('Company');
    }

    if (inContactHdr || inContactMenu) {
        displayMenuShadow('Contact');
    }
}

function hideMenu(name) {
    document.getElementById('td' + name).style.backgroundColor = '';
    document.getElementById('td' + name).style.color = '#6f6f6f';
    document.getElementById('menu' + name).style.visibility = 'hidden';
    document.getElementById('menu' + name + 'Shadow').style.visibility = 'hidden';
    document.getElementById('menu' + name + 'ShadowBottom').style.visibility = 'hidden';
    document.getElementById('menu' + name + 'ShadowBottomLeft').style.visibility = 'hidden';
    document.getElementById('menu' + name + 'ShadowRight').style.visibility = 'hidden';
    document.getElementById('menu' + name + 'ShadowBottomRight').style.visibility = 'hidden';
}

function hideMenus() {

    if (!inApplicationsHdr && !inApplicationsMenu) {
        hideMenu('Applications');
    }

    if (!inPartnersHdr && !inPartnersMenu) {
        hideMenu('Partners');
    }

    if (!inServicesHdr && !inServicesMenu) {
        hideMenu('Services');
    }

    if (!inCompanyHdr && !inCompanyMenu) {
        hideMenu('Company');
    }

    if (!inContactHdr && !inContactMenu) {
        hideMenu('Contact');
    }
}
