var iCurIndex1 = -1;
var iCurIndex2 = -1;
var strCurActionBanner = '';
var strCurMenu = 'Menü Deutsch';
var strLastVisibleMenuIcon = '';
var bCurrentIsStartPage = true;

function setBanner(strNumber, iTry)
{
    if(typeof(iTry) == 'undefined')
    {
        iTry = 1;
    }

    try
    {
        var strBannerNumber = '01';
        if(strNumber.length > 0)
        {
            strBannerNumber = strNumber;
        }

        top.contentFrame.getMovieName().callChangeSlider('_lccms_/banners/' + strBannerNumber + '/flashbanner.xml', '_lccms_/banners/' + strBannerNumber + '/flashsettings.xml', 'sliderconfig01.xml');
    }
    catch(E)
    {
        if(iTry < 10)
        {
            window.setTimeout('setBanner("' + strNumber + '", ' + (iTry + 1) + ');', 250);
        }
    }
}

function setMenu2(iIndex)
{
    try
    {
        top.contentFrame.leftMenuFrame.Menu_OnPageLoadHandler(iIndex);
    }
    catch(E)
    {
        window.setTimeout('setMenu2(' + iIndex + ');', 250);
    }
}

function onLcContentPageLoaded_completeHandler(strActionImageUrl, strActionBannerNumber, strActionHeadlineText, strActionLongtextUrl, iMenuItemIndex, strMenuName, iMenuItemLevel)
{
    var iIndex1 = -1;
    var iIndex2 = -1;

    var bIsStartPage = false;

    if(strMenuName == 'Menü Deutsch')
    {
        for(var i = 0; i < LCSiteMenus.length; i++)
        {
            if(LCSiteMenus[i][0] == 0 && LCSiteMenus[i][3] == strMenuName)
            {
                var bCountIndex2 = true;

                for(var j = i + 1 + iMenuItemIndex; j > i; j--)
                {
                    if(LCSiteMenus[j][0] == 1)
                    {
                        bCountIndex2 = false;
                        iIndex1++;
                    }
                    else if(bCountIndex2)
                    {
                        iIndex2++;
                    }
                }

                for(var j = i + 1 + iMenuItemIndex; j > i; j--)
                {
                    if(LCSiteMenus[j][0] == 1)
                    {
                        if(j == i + 1)
                        {
                            bIsStartPage = true;
                        }

                        break;
                    }
                }

                break;
            }
        }
    }

    if(strActionBannerNumber != strCurActionBanner)
    {
        strCurActionBanner = strActionBannerNumber;
        setBanner(strActionBannerNumber);
    }

    iCurIndex2 = iIndex2;
    if(iIndex1 != iCurIndex1)
    {
        iCurIndex1 = iIndex1;

        top.contentFrame.lcGraphTabHandleClick(iCurIndex1 + 1, false);
        window.open('http://www.leibetseder.info/leftMenuFrame_ger.htm', 'leftMenuFrame');
    }
    else
    {
        setMenu2(iCurIndex2);
    }

    if(strMenuName != strCurMenu || (bCurrentIsStartPage && !bIsStartPage))
    {
        if(strLastVisibleMenuIcon.length > 0)
        {
            top.contentFrame.document.getElementById(strLastVisibleMenuIcon).style.visibility = 'hidden';
            strLastVisibleMenuIcon = '';
        }

        if(strMenuName == 'Menü Beratung')
        {
            top.contentFrame.document.getElementById('areasymbolberatung').style.visibility = 'visible';
            strLastVisibleMenuIcon = 'areasymbolberatung';
            window.open('http://www.leibetseder.info/leftMenuFrame_ger-beratung.htm?selectitem=' + iMenuItemIndex, 'leftMenuFrame');
        }
        else if(strMenuName == 'Menü Therapie')
        {
            top.contentFrame.document.getElementById('areasymboltherapie').style.visibility = 'visible';
            strLastVisibleMenuIcon = 'areasymboltherapie';
            window.open('http://www.leibetseder.info/leftMenuFrame_ger-therapie.htm?selectitem=' + iMenuItemIndex, 'leftMenuFrame');
        }
        else if(strMenuName == 'Menü Mediation')
        {
            top.contentFrame.document.getElementById('areasymbolmediation').style.visibility = 'visible';
            strLastVisibleMenuIcon = 'areasymbolmediation';
            window.open('http://www.leibetseder.info/leftMenuFrame_ger-mediation.htm?selectitem=' + iMenuItemIndex, 'leftMenuFrame');
        }
        else if(strMenuName == 'Menü Training')
        {
            top.contentFrame.document.getElementById('areasymboltraining').style.visibility = 'visible';
            strLastVisibleMenuIcon = 'areasymboltraining';
            window.open('http://www.leibetseder.info/leftMenuFrame_ger-training.htm?selectitem=' + iMenuItemIndex, 'leftMenuFrame');
        }
        else
        {
            top.contentFrame.document.getElementById('areasymbolinactive').style.visibility = 'visible';
            strLastVisibleMenuIcon = 'areasymbolinactive';
            if(iIndex1 < 0)
            {
                window.open('http://www.leibetseder.info/leftMenuFrame_ger.htm', 'leftMenuFrame');
            }
        }
    }

    if((strMenuName == 'Menü Beratung' || strMenuName == 'Menü Therapie' || strMenuName == 'Menü Mediation' || strMenuName == 'Menü Training') && (strCurMenu == strMenuName))
    {
        setMenu2(iMenuItemIndex);
    }

    strCurMenu = strMenuName;

    if(bIsStartPage != bCurrentIsStartPage)
    {
        bCurrentIsStartPage = bIsStartPage;
        var iWindowHeight = LCLib_GetWindowHeight(600);

        var iTop = 294;
        if(bIsStartPage)
        {
            iTop = 386;
        }

        top.contentFrame.document.getElementById('menu').style.top = iTop + 'px';
        top.contentFrame.document.getElementById('menu').firstChild.style.height = (iWindowHeight - iTop - 60) + 'px';

        if(bIsStartPage && strLastVisibleMenuIcon.length > 0)
        {
            top.contentFrame.document.getElementById(strLastVisibleMenuIcon).style.visibility = 'hidden';
            strLastVisibleMenuIcon = '';
        }

        top.contentFrame.document.getElementById('linedivide').style.top = ((bIsStartPage ? '354' : '279')) + 'px';
        top.contentFrame.document.getElementById('news').style.visibility = (bIsStartPage ? 'visible' : 'hidden');
    }

    top.contentFrame.document.getElementById('actiontext').innerHTML = (bIsStartPage ? 'Aktuelles' : strActionHeadlineText);
}

