﻿
var selItem = '';
var staticPanel = ''; //'panel_01';
var onPanel = ''; //'panel_01';
var thePanel = ''; //'panel_01';

var selItem_SUB = '';
var staticPanel_SUB = '';
var onPanel_SUB = '';
var thePanel_SUB = '';
var sub_menu_active_eid = '';

var dbg_PANELIMG = '';

var g1_t;
var g1_timer_is_on = 0;

var g2_t;
var g2_timer_is_on = 0;

var g1_eid;
var g2_eid;

function g1_timedCount() {

    mouseOverOperation(g1_eid);
    clearTimeout(g1_t);
    g1_timer_is_on = 0;

}

function g1_doTimer(eid) {
    if (!g1_timer_is_on) {
        g1_timer_is_on = 1;
        g1_eid = eid;
        g1_t = setTimeout("g1_timedCount()", 250);
    }
}

function g1_stopCount() {
    clearTimeout(g1_t);
    g1_timer_is_on = 0;
}

function g2_timedCount() {

    mouseOverOperation_SUB(g2_eid); ;
    clearTimeout(g2_t);
    g2_timer_is_on = 0;

}

function g2_doTimer(eid_SUB) {
    if (!g2_timer_is_on) {
        g2_timer_is_on = 1;
        g2_eid = eid_SUB;
        g2_t = setTimeout("g2_timedCount()", 300);
    }
}

function g2_stopCount() {
    clearTimeout(g2_t);
    g2_timer_is_on = 0;
}
// BEGIN MASTER HEADER

function mouseOver(eid_SUB) {

    g1_doTimer(eid_SUB);

}

function mouseOverOperation(eid) {

    document.getElementById(GetClientId('pnl_mobi_01')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_mobi_02')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_mobi_03')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_mobi_04')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_mobi_05')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_mobi_06')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_mobi_07')).className = 'defaultDIVPNL_SUB';

    document.getElementById(GetClientId('pnl_stat_01')).className = 'defaultDIVPNL_SUB';  //document.getElementById("FlabellComponent").style.height = '328px'; } else { document.getElementById("FlabellComponent").style.height = 0; }
    document.getElementById(GetClientId('pnl_stat_02')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_stat_03')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_stat_04')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_stat_05')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_stat_06')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_stat_07')).className = 'defaultDIVPNL_SUB';

    document.getElementById(GetClientId('pnl_home_01')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_home_02')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_home_03')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_home_04')).className = 'defaultDIVPNL_SUB';

    document.getElementById(GetClientId('pnl_cyli_01')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_cyli_02')).className = 'defaultDIVPNL_SUB';

    document.getElementById(GetClientId('pnl_pars_01')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_pars_02')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_pars_03')).className = 'defaultDIVPNL_SUB';

    document.getElementById(GetClientId('pnl_cont_01')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_cont_02')).className = 'defaultDIVPNL_SUB';
    document.getElementById(GetClientId('pnl_cont_03')).className = 'defaultDIVPNL_SUB';

    if (selItem != '') { document.getElementById(selItem).className = "defaultTblHeader"; }
    if (onPanel != '') { document.getElementById(GetClientId(onPanel)).className = "defaultDIVPNL"; }

    selItem = eid;

    document.getElementById(eid).className = "defaultTblHeader_active";

    panelSwitch(selItem, 1, 1);
}


function panelSwitch(eid, on, pStatic) {

    if (eid == 'td01') { thePanel = 'panel_01'; } //document.getElementById("FlabellComponent").style.height = '328px'; } else { document.getElementById("FlabellComponent").style.height = 0; }
    if (eid == 'td02') { thePanel = 'panel_02'; }
    if (eid == 'td03') { thePanel = 'panel_03'; }
    if (eid == 'td04') { thePanel = 'panel_04'; }
    if (eid == 'td05') { thePanel = 'panel_05'; }
    if (eid == 'td06') { thePanel = 'panel_06'; }
    if (eid == 'td07') { thePanel = 'panel_07'; }

    if (pStatic == 1) {
        staticPanel = thePanel;
    }

    if (on == 1) {
        document.getElementById(GetClientId(thePanel)).className = 'defaultPanel_show';

        if (thePanel == staticPanel) {
            document.getElementById(GetClientId(thePanel)).className = 'defaultPanel_show ' + thePanel + '_active';
        }
        else {
            document.getElementById(GetClientId(thePanel)).className = 'defaultPanel_show ' + thePanel + '_default';
        }

        onPanel = thePanel;

    } else {
        document.getElementById(GetClientId(thePanel)).className = 'defaultDIVPNL';
    }
}
// END MASTER HEADER




// BEGIN SUB HEADER HEADER

function mouseOver_SUB(eid_SUB) {

    g2_doTimer(eid_SUB);

}

function mouseOverOperation_SUB(eid_SUB) {

    //selectedClick_SUB(eid_SUB);
    if (selItem_SUB != '') { document.getElementById(selItem_SUB).className = "defaultTblHeader_SUB"; }
    if (onPanel_SUB != '') { document.getElementById(GetClientId(onPanel_SUB)).className = "defaultDIVPNL_SUB"; }

    selItem_SUB = eid_SUB;

    document.getElementById(eid_SUB).className = "defaultTblHeader_active_SUB";

    panelSwitch_SUB(selItem_SUB, 1, 1);

}

function panelSwitch_SUB(eid_SUB, on_SUB, pStatic_SUB) {

    if (eid_SUB == 'td_mobi_01') { thePanel_SUB = 'pnl_mobi_01'; } //document.getElementById("FlabellComponent").style.height = '328px'; } else { document.getElementById("FlabellComponent").style.height = 0; }
    if (eid_SUB == 'td_mobi_02') { thePanel_SUB = 'pnl_mobi_02'; }
    if (eid_SUB == 'td_mobi_03') { thePanel_SUB = 'pnl_mobi_03'; }
    if (eid_SUB == 'td_mobi_04') { thePanel_SUB = 'pnl_mobi_04'; }
    if (eid_SUB == 'td_mobi_05') { thePanel_SUB = 'pnl_mobi_05'; }
    if (eid_SUB == 'td_mobi_06') { thePanel_SUB = 'pnl_mobi_06'; }
    if (eid_SUB == 'td_mobi_07') { thePanel_SUB = 'pnl_mobi_07'; }

    if (eid_SUB == 'td_stat_01') { thePanel_SUB = 'pnl_stat_01'; } //document.getElementById("FlabellComponent").style.height = '328px'; } else { document.getElementById("FlabellComponent").style.height = 0; }
    if (eid_SUB == 'td_stat_02') { thePanel_SUB = 'pnl_stat_02'; }
    if (eid_SUB == 'td_stat_03') { thePanel_SUB = 'pnl_stat_03'; }
    if (eid_SUB == 'td_stat_04') { thePanel_SUB = 'pnl_stat_04'; }
    if (eid_SUB == 'td_stat_05') { thePanel_SUB = 'pnl_stat_05'; }
    if (eid_SUB == 'td_stat_06') { thePanel_SUB = 'pnl_stat_06'; }
    if (eid_SUB == 'td_stat_07') { thePanel_SUB = 'pnl_stat_07'; }

    if (eid_SUB == 'td_home_01') { thePanel_SUB = 'pnl_home_01'; }
    if (eid_SUB == 'td_home_02') { thePanel_SUB = 'pnl_home_02'; }
    if (eid_SUB == 'td_home_03') { thePanel_SUB = 'pnl_home_03'; }
    if (eid_SUB == 'td_home_04') { thePanel_SUB = 'pnl_home_04'; }

    if (eid_SUB == 'td_cyli_01') { thePanel_SUB = 'pnl_cyli_01'; }
    if (eid_SUB == 'td_cyli_02') { thePanel_SUB = 'pnl_cyli_02'; }

    if (eid_SUB == 'td_pars_01') { thePanel_SUB = 'pnl_pars_01'; }
    if (eid_SUB == 'td_pars_02') { thePanel_SUB = 'pnl_pars_02'; }
    if (eid_SUB == 'td_pars_03') { thePanel_SUB = 'pnl_pars_03'; }

    if (eid_SUB == 'td_cont_01') { thePanel_SUB = 'pnl_cont_01'; }
    if (eid_SUB == 'td_cont_02') { thePanel_SUB = 'pnl_cont_02'; }
    if (eid_SUB == 'td_cont_03') { thePanel_SUB = 'pnl_cont_03'; }

    sub_menu_active_eid = eid_SUB;

    if (pStatic_SUB == 1) { staticPanel_SUB = thePanel_SUB; };

    if (on_SUB == 1) {

        document.getElementById(GetClientId(thePanel_SUB)).className = 'defaultPanel_show_SUB';

        if (thePanel == staticPanel) {
            document.getElementById(GetClientId(thePanel_SUB)).className = 'defaultPanel_show_SUB ' + thePanel_SUB + '_active_SUB';
        } else {
            document.getElementById(GetClientId(thePanel_SUB)).className = 'defaultPanel_show_SUB ' + thePanel_SUB + '_default_SUB';
        }

        onPanel_SUB = thePanel_SUB;

    } else {
        document.getElementById(GetClientId(thePanel_SUB)).className = 'defaultDIVPNL_SUB';
    }
}

function clickNavCookie(t1, t2, tLink) {
    $.cookie("eid", null);
    $.cookie("eid_SUB", null);

    $.cookie("eid", t1, { path: '/' });
    $.cookie("eid_SUB", t2, { path: '/' });

    if (tLink != '') { location = tLink; }
}

function load() {
    selItem = $.cookie("eid");
    selItem_SUB = $.cookie("eid_SUB");

    if (selItem_SUB == null) { selItem_SUB = ''; }

    if (selItem == null) {
        selItem = 'td01';
        $.cookie("eid", selItem);
        mouseOverOperation(selItem);
    } else {
        mouseOver(selItem);
        if (selItem_SUB != null) {
            if (selItem == 'td02' || selItem == 'td03') {
                mouseOverOperation_SUB(selItem_SUB)
            }
        }
    }
}
