var lc_strImgUrl = '';

var lc_arMenuObject;
var lc_iMenuIndex;
var lc_strMenuName;

    if(typeof(displayMenu) == 'undefined')
    {
        var displayMenu = 'bet';

        var iPos = self.location.search.indexOf('?LANG=');
        if(iPos == -1)
        {
            iPos = self.location.search.indexOf('&LANG=');
        }

        if(iPos > -1)
        {
            displayMenu = self.location.search.substr(iPos + 6);
        }
        }


function onLcContentPageLoaded_userDefHandler(arMenuObject, iMenuIndex, strMenuName)
{
    if(typeof(lc_iMenuIndex)=='undefined')
    {
    lc_arMenuObject = arMenuObject;
    lc_iMenuIndex = iMenuIndex;
    lc_strMenuName = strMenuName;
    }

    onLcContentPageLoaded_realUserDefHandler();
}

function onLcContentPageLoaded_realUserDefHandler()
{//alert(top.menuFrame);
    if(typeof(top.menuFrame.Menu_OnPageLoadHandler) == 'undefined' ||
            typeof(top.menuFrame.SetActiveItem) == 'undefined')
    {
        window.setTimeout('onLcContentPageLoaded_userDefHandler()', 1000);
    }
    else
    {
        var arMenuObject = lc_arMenuObject;
        var iMenuIndex = lc_iMenuIndex;
        var strMenuName = lc_strMenuName;
        if(displayMenu == 'bet') displayMenun='betrieb';
        else if(displayMenu=='nat')displayMenun='natur';
            else if(displayMenu=='sch')displayMenun='schloss';
                else if(displayMenu=='hau')displayMenun='haus';
                    else displayMenun='familie';

        var iSub = 0;
        for(var i = 0; i < LCSiteMenus.length; i++)
        {
            if(LCSiteMenus[i][0] == 0 && LCSiteMenus[i][3].toLowerCase() == 'menü ' + displayMenun )
            {
                iSub = i + 1;
                break;
            }
        }
        if(strMenuName.toLowerCase() == 'menü ' + displayMenun)
        {

            top.menuFrame.Menu_OnPageLoadHandler(iMenuIndex - iSub);
        }
        else
        {
            top.menuFrame.SetActiveItem(null);
        }
    }
}


var lc_strBannerID = '';
var strCurrentBannerID = '';

function onLcContentPageLoaded_realBannerChangeHandler()
{
    //alert(strCurrentBannerID);
    //alert(lc_strBannerID);
    try
    {
        if(strCurrentBannerID != lc_strBannerID)
        {

            //alert(lc_strBannerID);
            if(lc_strBannerID.length > 0)
            {
                top.menuFrame.document.getElementById('actionbannerdiv').innerHTML='<IFRAME NAME="actionbannerFrame" MARGINWIDTH="0" MARGINHEIGHT="0" SRC="http://www.schloss-pernegg.at/_lccms_/banners/' + lc_strBannerID + '/bannerinclude.htm" WIDTH="555" HEIGHT="143" SCROLLING="No" NORESIZE FRAMEBORDER="0" HSPACE="0" VSPACE="0" ALIGN="left"></IFRAME>';
                //top.actionbannerFrame.location.replace('http://www.officecms.com/members/gemeindestenzen/_lccms_/banners/' + lc_strBannerID + '/bannerinclude.htm');
            }
            else
            {
                top.menuFrame.document.getElementById('actionbannerdiv').innerHTML='<IFRAME NAME="actionbannerFrame" MARGINWIDTH="0" MARGINHEIGHT="0" SRC="http://www.schloss-pernegg.at/actionbannerFrame.htm" WIDTH="555" HEIGHT="143" SCROLLING="No" NORESIZE FRAMEBORDER="0" HSPACE="0" VSPACE="0" ALIGN="left"></IFRAME>';
                //top.actionbannerFrame.location.replace('http://www.officecms.com/members/gemeindestenzen/actionbannerFrame.htm');
            }


            strCurrentBannerID = lc_strBannerID;
        }
    }
    catch(ex)
    {
        window.setTimeout('onLcContentPageLoaded_realBannerChangeHandler()', 1000);
    }
}

function onLcContentPageLoaded_bannerChangeHandler(strBannerID)
{
    lc_strBannerID = strBannerID;
    onLcContentPageLoaded_realBannerChangeHandler();
    //alert(top.menuFrame.document.getElementById('actionbannerdiv').innerHTML);
}

function switchLanguage(strLang, iMenuItemIndex, strActionBannerNumber)
{
	//try	
	{
		top.contentFrame.displayMenu = top.displayMenu = strLang;		
		top.frames.menuFrame.location.replace('http://www.schloss-pernegg.at/menuFrame_' + strLang + '.htm?MenuItemIndex=' + iMenuItemIndex + '&ActionBannerNumber=' + strActionBannerNumber);
		
		if(strLang == 'fam')
		{
			top.contentFrame.document.getElementById('newsFrameCell').style.display = 'none';
			top.contentFrame.document.getElementById('bodyFrameCell').style.width = '1010px';
			top.contentFrame.document.getElementById('bodyFrame').style.width = '1010px';
			top.contentFrame.document.getElementById('bodyFrameCell').style.borderLeft = 'none 0px transparent';			
		}
		else
		{
			top.contentFrame.document.getElementById('newsFrameCell').style.display = 'block';
			top.contentFrame.document.getElementById('bodyFrameCell').style.width = '778px';
			top.contentFrame.document.getElementById('bodyFrame').style.width = '778px';
			top.contentFrame.document.getElementById('bodyFrameCell').style.borderLeft = '#284d10 1px solid';
			top.contentFrame.document.getElementById('newsFrame').location.replace('http://www.schloss-pernegg.at/newsFrame_' + strLang + '.htm');
			switch(displayMenu)
			{
				case 'sch':
					top.contentFrame.document.getElementById('pageTextCell').innerHTML = top.SeitentextSchloss_Text;
					break;
				case 'bet':
					top.contentFrame.document.getElementById('pageTextCell').innerHTML =  top.SeitentextBetrieb_Text;
					break;
				case 'nat':
					top.contentFrame.document.getElementById('pageTextCell').innerHTML =  top.SeitentextNatur_Text;
					break;
				case 'hau':
					top.contentFrame.document.getElementById('pageTextCell').innerHTML = top.SeitentextHaus_Text;
					break;
			}					
		}
	}
	//catch(E)
	{
		//window.setTimeout('switchLanguage("' + strLang + '");', 250);
	}
}

function onLcContentPageLoaded_completeHandler(strActionImageUrl, strActionBannerNumber, strActionHeadlineText, strActionLongtextUrl, iMenuItemIndex, strMenuName, iMenuItemLevel, iMenuItemId, strURL)
{
    //alert(top.contentFrame.bodyFrame.document.location.href);
    if(strMenuName == 'Menü Betrieb' && displayMenu != 'bet')
    {
        //top.document.location.href = 'http://www.schloss-pernegg.at?SHOW_URL=' + top.contentFrame.bodyFrame.document.location.href;        
        //window.open(top.contentFrame.bodyFrame.document.location.href, '_top');
        switchLanguage('bet', iMenuItemIndex, strActionBannerNumber);
        return;
    }
    else if(strMenuName == 'Menü Natur' && displayMenu != 'nat')
    {
        //window.open(top.contentFrame.bodyFrame.document.location.href, '_top');
        switchLanguage('nat', iMenuItemIndex, strActionBannerNumber);
        return;
    }
    else if(strMenuName == 'Menü Haus' && displayMenu != 'hau')
    {
        //window.open(top.contentFrame.bodyFrame.document.location.href, '_top');
        switchLanguage('hau', iMenuItemIndex, strActionBannerNumber);
        return;
    }
    else if(strMenuName == 'Menü Schloss' && displayMenu != 'sch')
    {
        //top.document.location.href = 'http://www.schloss-pernegg.at?SHOW_URL=' + top.contentFrame.bodyFrame.document.location.href;
        switchLanguage('sch', iMenuItemIndex, strActionBannerNumber);
        //window.open(top.contentFrame.bodyFrame.document.location.href, '_top');
        return;
    }
    else if(strMenuName == 'Menü Familie' && displayMenu != 'fam')
    {
    		switchLanguage('fam', iMenuItemIndex, strActionBannerNumber);
        //window.open(top.contentFrame.bodyFrame.document.location.href, '_top');
        return;
    }

    var iSetActiveHvMenuItem = -1;

        if((displayMenu == 'hau' && strMenuName == 'Menü Haus') || (displayMenu == 'bet' && strMenuName == 'Menü Betrieb') || (displayMenu == 'nat' && strMenuName == 'Menü Natur') || (displayMenu == 'sch' && strMenuName == 'Menü Schloss') || (displayMenu == 'fam' && strMenuName == 'Menü Familie'))
    {

            setActiveHvMenuItem(iMenuItemIndex);
      }
}

function setActiveHvMenuItem(iItem)
{
    try
    {
        top.menuFrame.Menu_OnPageLoadHandler(iItem);
    }
    catch(e)
    {
        window.setTimeout('setActiveHvMenuItem(' + iItem + ');', 250);
    }
}
