var lc_iMenuItemIndex;
var lc_strMenuName;

var bFirstCall = true;

function onLcContentPageLoaded_realMenuItemIndexHandler()
{
    try
    {
        if(top.menuFrame.bHvMenuIsLoaded)
        {
            if(lc_strMenuName == 'Menü Deutsch' || lc_strMenuName == 'Menü Englisch')
            {
                if(bFirstCall)
                {
                    window.setTimeout('top.menuFrame.Menu_OnPageLoadHandler(lc_iMenuItemIndex);', 500);
                }
                else
                {
                    top.menuFrame.Menu_OnPageLoadHandler(lc_iMenuItemIndex);
                }
            }
            else
            {
                if(bFirstCall)
                {
                    window.setTimeout('top.menuFrame.Menu_OnPageLoadHandler(-1);', 500);
                }
                else
                {
                    top.menuFrame.Menu_OnPageLoadHandler(-1);
                }
            }

            bFirstCall = false;
        }
        else
        {
            window.setTimeout('onLcContentPageLoaded_realMenuItemIndexHandler();', 250);
        }
    }
    catch(e)
    {
        window.setTimeout('onLcContentPageLoaded_realMenuItemIndexHandler();', 250);
    }
}

function onLcContentPageLoaded_menuItemIndexHandler(iMenuItemIndex, strMenuName)
{
    lc_iMenuItemIndex = iMenuItemIndex;
    lc_strMenuName = strMenuName;

    onLcContentPageLoaded_realMenuItemIndexHandler();
}

var lc_strBannerID = '';
var strCurrentBannerID = '';

function onLcContentPageLoaded_realBannerChangeHandler()
{
    try
    {
        if(strCurrentBannerID != lc_strBannerID)
        {
            if(lc_strBannerID.length > 0)
            {
                top.contentFrame.actionBannerFrame.location.replace('http://www.mothwurf.com/_lccms_/banners/' + lc_strBannerID + '/bannerinclude.htm');
            }
            else
            {
                top.contentFrame.actionBannerFrame.location.replace('http://www.mothwurf.com/actionBannerFrame.htm');
            }


            strCurrentBannerID = lc_strBannerID;
        }
    }
    catch(ex)
    {
        window.setTimeout('onLcContentPageLoaded_realBannerChangeHandler()', 100);
    }
}

function onLcContentPageLoaded_bannerChangeHandler(strBannerID)
{
    lc_strBannerID = strBannerID;
    onLcContentPageLoaded_realBannerChangeHandler();
}

var bCurGalleryView = false;

function setGalleryView(bGalleryView, iTry)
{
    if(typeof(iTry) == 'undefined')
    {
        iTry = 1;
    }

    try
    {
			if(bGalleryView)
    	{
        top.contentFrame.document.getElementById('trTop').style.display = 'none';
		  	top.contentFrame.document.getElementById('trMiddle').height = '8px';
		  	top.contentFrame.document.getElementById('trBottom').style.display = 'block';
    	}
    	else
    	{
        top.contentFrame.document.getElementById('trTop').style.display = 'block';
		  	top.contentFrame.document.getElementById('trMiddle').height = '3px';
		  	top.contentFrame.document.getElementById('trBottom').style.display = 'none';
    	}    
    }
    catch(E)
    {
        if(iTry < 10)
        {
            window.setTimeout('setGalleryView(' + bGalleryView + ',' + (iTry + 1) + ');', 250);
        }
    }
    
}


function onLcContentPageLoaded_completeHandler(strActionImageUrl, strActionBannerNumber, strActionHeadlineText, strActionLongtextUrl, iMenuItemIndex, strMenuName, iMenuItemLevel)
{
	var bGalleryView = (strActionHeadlineText == '#');
  if(bGalleryView != bCurGalleryView)
  {

      bCurGalleryView = bGalleryView;
      setGalleryView(bGalleryView);
  }
	
}