﻿/////javascript popupmenu
var timer = 0;
var timershow = 0;
var logintimer = 0;
var max = 130;
var selected = 0;
var selectedbullet = 0;
var hideLogin = 1;




//showing and hiding main menu
function menu(id, lang, on) {    
    
    //show
    if (on == 1) {
        timershow = setTimeout("showmenu(" + id + ", '" + lang + "')", 400);
        clearTimeout(timer);
        
    //hide
    } else {
        clearTimeout(timershow);
        if (selected != 0) {
            starthide(id, lang); 
        }
    }
}

function showmenu(id, lang) {
    //hide all menus
    for (a = 10; a <= max; a = a + 10) {
        if (a != id) {
            if (document.getElementById("menu" + a)) {
                document.getElementById("menu" + a).src = "Images/menu" + a + lang + "_off.gif";
                document.getElementById("popup" + a).style.visibility = 'hidden';

            }
        }
    }
    clearTimeout(timershow); 


    document.getElementById("menu" + id).src = "Images/menu" + id + lang + "_on.gif";
    document.getElementById("popup" + id).style.visibility = 'visible';

    //show current menu
    clearTimeout(timer);  
}

//start hiding
function starthide(id, lang) {
    clearTimeout(timershow);
    timer = setTimeout("hidepopup(" + id + ", '" + lang + "')", 400);
}

//hide main menu and popups
function hidepopup(id, lang) {
    //hide popups and colors
    document.getElementById("menu" + id).src = "Images/menu" + id + lang + "_off.gif";
    document.getElementById("popup" + id).style.visibility = 'hidden';

    //show selected menu
    if (selected != 0) {
        showmenu(selected, lang);
    }
}


//displaying supermenu bullets
function supermenu(id, on) {
    //hide all menus
    for (a=10; a <= max; a=a+5) {
        if (document.getElementById("bullet" + a)) {
              document.getElementById("bullet" + a).src = "Images/bullet_off.gif";
        }

    }
    if (on == 1) {
        document.getElementById("bullet" + id).src = "Images/bullet_on.gif";
    } else if (selectedbullet != 0) {
        supermenu(selectedbullet, 1);
    }
}

//showing login
function login(on) {
    clearTimeout(logintimer);
    if (on == 1) {
        
        logintimer = setTimeout("document.getElementById('login').style.visibility = 'visible';", 150);
    } else if (hideLogin == 1) {
        
        logintimer = setTimeout("document.getElementById('login').style.visibility = 'hidden';", 200);
        
    }
}


//showing stockexchange live
function se(on, lang) {
    if (on == 1) {
        clearTimeout(timer);
        document.getElementById('se').style.visibility = 'visible';
        document.getElementById('seclose').style.visibility = 'visible';
        document.getElementById('ctl00_Menu_Menu_setab').style.display = 'none';
        document.getElementById('ctl00_Menu_Menu_setab_on').style.display = 'block';
        if (selected != 0)
            document.getElementById("menu" + selected).src = "Images/menu" + selected + lang + "_off.gif";
        //document.getElementById("cover").style.visibility = 'visible';
        //document.body.style.overflow = 'hidden';
    } else {
        document.getElementById('se').style.visibility = 'hidden';
        document.getElementById('seclose').style.visibility = 'hidden';
        document.getElementById('ctl00_Menu_Menu_setab').style.display = 'block';
        document.getElementById('ctl00_Menu_Menu_setab_on').style.display = 'none';
        if (selected != 0)
            document.getElementById("menu" + selected).src = "Images/menu" + selected + lang + "_on.gif";
        //document.getElementById("cover").style.visibility = 'hidden';
        //document.body.style.overflow = 'auto';
    }
}


